Search code examples
iphoneiosipad

missing copy/paste menu in UITextField/UIWebView


I'm having a problem and I can't find a workaround for it.

I have a view with a UIWebView implementation and a UITextField. On both, when I tap, I do not get the copy/paste menu to appear.

The UIWebView has text in it (text only) and I can select either a word, or a paragraph or make the magnification glass appear and manually select the text I want.

On the other hand, UITextField can take input and works as intended, except for the copy/paste functions.

Nothing is sub-classed. I need only the default implementation of iOS for the copy/paste functions.

This problem is not in a single view. I have another UIWebView with the same problem elsewhere so I think this is a global problem.

I have done all the obvious (import UIKit and Foundation frameworks, assign properties, releasing etc) but again I'm stuck on this.

What might interact/interfere with such a simple functionality, disabling it? Moreover, always under the simplest implementation, what else is needed for this to work? (any framework I'm missing, any property etc).

Such a simple thing and I'm stuck with it. If anyone has any idea its much appreciated.

==== Edit ====

The problem is not caused by my code in any view or class.

I have added a new view (the application is tabbar based) with only a UITextField and a UITextView with the default "Lorem Ipsum" text. On the textView I can also select text but no menu to copy/paste/select/select All. This also happens in the textField (empty) where no paste menu appears (I copy some text from another app, ex. Safari or Notes).

It seems the problem is somewhere else affecting universally the app, in all views.

I have removed Frameworks references and put them back but nothing happened. I'm still trying to figure from where this comes.


Solution

  • I had the same problem – everything else was working correctly, but all UITextViews were missing "copy / paste / select" menu, globally, through all application.

    After some experimenting, I've found that the cause was either:

    "Visible at Launch" property not set on a Window in MainWindow.xib

    OR

    Missing call to [self.window makeKeyAndVisible] inside application:didFinishLaunchingWithOptions: method of AppDelegate.

    It works fine after fixing any of those. Try it.