ios - 为什么可视化调试看不到inputAccessoryView?

标签 ios xcode debugging inputaccessoryview

我在这里附上了模拟器截图和 View 调试窗口。 screenshot from xcode view debuggersimulator screenshot

如您所见,inputAccessoryView 在模拟器中可见,但在可视化调试中不可见,不明白为什么,请帮助:)

inputAccessoryView 的代码:

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        view.backgroundColor = .blue
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override var inputAccessoryView: UIView? {
        let v = UIView.init(frame: CGRect.init(x: 0, y: 0, width: view.frame.size.width, height: 60))
        v.backgroundColor = .red
        let label = UILabel()
        label.textAlignment = .center
        label.translatesAutoresizingMaskIntoConstraints = false
        v.addSubview(label)
        label.text = "inputAccessoryView"
        label.widthAnchor.constraint(equalToConstant: 250).isActive = true
        label.centerXAnchor.constraint(equalTo: v.centerXAnchor).isActive = true
        label.centerYAnchor.constraint(equalTo: v.centerYAnchor).isActive = true
        return v
    }

    override var canBecomeFirstResponder: Bool {
        return true
    }
}

最佳答案

inputAccessoryView 位于另一个名为 UITextEffectsWindow 的窗口中,要使其显示在 View 调试器中,您必须从调试中选择该窗口或窗口中的任何子项导航器选项卡

关于ios - 为什么可视化调试看不到inputAccessoryView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51115841/

相关文章:

ios - Cordova 3.1.0 : Command Line interface not working

xcode - 如何让 UIAutomation、模拟器和 Xcode 调试器同时运行?

c# - 我第二次在 HttpPost 中使用 "getResponse()",它只能逐步调试

ios - 即使 enableBackgroundingOnSocket 设置为 TRUE,XMPPFramework 也不会发送在后台保持事件状态

iOS 13 仅在用户 "Allow Once"之后再次调用 requestAlwaysAuthorization

ios - Swift 3 如何使用 SSL Pinning 和 AlamoFire 验证服务器证书?

ios - 使用 Xcode 9 和 iPhone 7 更新 ios11.1

c - 向 Xcode 添加头文件

debugging - 在 Debug模式下运行 JVM 的副作用

javascript - jQuery console.log() 在 Firefox 中不起作用