我正在使用gdb调试Qt gui应用程序。 该应用程序跨两个屏幕,在第一个屏幕上按下鼠标时需要中断,我这样设置断点:
class ViewController: UIViewController {
var currentViewController: UIViewController? = nil
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let vctrl2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "viewcontroller2") as! ViewController2
vctrl2.delegate = self
self.view.addSubview(vctrl2.view)
self.addChild(vctrl2)
self.currentViewController = vctrl2
}
func openTargetViewController(vctrl: UIViewController) {
guard let currVCtrl = self.currentViewController else {
return
}
let oldVCtrl = self.currentViewController!
if currVCtrl != vctrl {
self.currentViewController = vctrl
}
self.view.addSubview(self.currentViewController!.view)
self.addChild(self.currentViewController!)
var frame = self.currentViewController!.view.frame
frame.origin.y = UIScreen.main.bounds.size.height
self.currentViewController!.view.frame = frame
self.currentViewController!.view.alpha = 0
UIView.animate(withDuration: 5.0, animations: { [weak self] in
frame.origin.y = 0
self!.currentViewController!.view.frame = frame
self!.currentViewController!.view.alpha = 1
}) { (finished) in
oldVCtrl.view.removeFromSuperview()
oldVCtrl.removeFromParent()
}
}
}
extension ViewController: VCtrl2Delegate {
func openVCtrl2() {
let vctrl3 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "viewcontroller3") as! ViewController3
vctrl3.delegate = self
self.openTargetViewController(vctrl: vctrl3)
}
}
extension ViewController: VCtrl3Delegate {
func openVCtrl3() {
let vctrl2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "viewcontroller2") as! ViewController2
vctrl2.delegate = self
self.openTargetViewController(vctrl: vctrl2)
}
}
但是,无论e-> globalPos.xp如何更改,gdb总是会打破这一点! 即使我打印了表达式并且显示为false,中断仍然有效。 有帮助吗?