Red Mak
Red Mak

Reputation: 676

Copy/paste UIMenuItem not showing in all my application

I have a problem that occurs in all my application (minimum target iOS13): there's no UIMenuController displayed, neither in UISearchBar nor in UITextFieald.

I tried to subclass a UITextField and override canPerformAction, the func is triggered, i return true but nothing happen..

can anyone help, thanks.

Upvotes: 1

Views: 348

Answers (1)

Red Mak
Red Mak

Reputation: 676

The problem was the call of "window.makeKeyAndVisible()" in the sceneDelegate

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

        guard let windowScene = (scene as? UIWindowScene) else { return }        
        let window = UIWindow(frame: UIScreen.main.bounds)
        window.rootViewController = TabBarController()
        // i delete this line and the UIMenuController are displayed ! 
        -> window.makeKeyAndVisible()<-
        self.window = window
        self.window?.windowScene =  windowScene
        self.window!.makeKeyAndVisible()
    }

Upvotes: 2

Related Questions