为什么可视化调试看不到inputAccessoryView?
Why inputAccessoryView is not visible in visual debugging?
我在这里附上了模拟器截图和调试视图window。
screenshot from xcode view debugger 和
simulator 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
的 window 上,要使其显示在视图调试器中,您必须 select window 或任何调试导航器选项卡 window 中的子项
我在这里附上了模拟器截图和调试视图window。 screenshot from xcode view debugger 和 simulator 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
的 window 上,要使其显示在视图调试器中,您必须 select window 或任何调试导航器选项卡 window 中的子项