swift playground UITextField spawns keyboard that is too big

前端 未结 3 620
再見小時候
再見小時候 2021-02-08 04:26

Swift in playground on Mac OS. When the user clicks in a UItextfield, a keyboard spawns but it is very large compared to the view and only the first few keys are available.

3条回答
  •  抹茶落季
    2021-02-08 05:11

    Instead this line

    PlaygroundPage.current.liveView = MyViewController()
    

    Write this

    let window = UIWindow(frame: CGRect(x: 0,
                                        y: 0,
                                        width: 768,
                                        height: 1024))
    let viewController = MyViewController()
    window.rootViewController = viewController
    window.makeKeyAndVisible()
    
    PlaygroundPage.current.liveView = window
    

    It works in Xcode 11

提交回复
热议问题