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.
I had the same problem – everything else was working correctly, but all UITextView
s 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.
If you work with Xcode 11+ and iOS 13+ projects (and SceneDelegate
),
make sure that you apply changes in that exact order:
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow()
window!.rootViewController = rootNavigation
window!.windowScene = windowScene
window!.makeKeyAndVisible()
}
}
because, if you will apply it something like that:
window!.makeKeyAndVisible()
window!.windowScene = windowScene
you will have described in question problem. It will appear and look fine, work, but copy-paste actions will not appear. It took me a while to find this out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With