我能够为我的按钮编写一个UIAlertController,它工作正常,但是当我按下YES或OK按钮时,我不知道如何切换到不同的页面.目前,YES或OK按钮无处可去.
@IBAction func SubmitButton(sender: AnyObject) {
if a > 28.87 {
var alert = UIAlertController(title: "H4 with Guide Pins", message: "Can it be removed?", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "YES", style: UIAlertActionStyle.Default, handler: nil))
alert.addAction(UIAlertAction(title: "NO", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
else if data2.text == "" {
var alert = UIAlertController(title: "Dimension", message: "Missing Data Input.", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
else {
var alert = UIAlertController(title: "H4 …Run Code Online (Sandbox Code Playgroud) 我只是固有一个来自前一个程序员的新应用程序,并继续遇到"不兼容的整数到指针转换,从'BOOL'(又名'bool')分配给'BOOL*'(又名'bool*')".
像这样的代码
_backButtonPressed = YES;
_isEdited = YES;
Run Code Online (Sandbox Code Playgroud)
想出同样的错误.我试过*(_ backButtonPressed)= YES; 和*_backButtonPressed =是,但两种情况都会导致程序崩溃.
如果我不管它,程序仍然有效,但我想保持代码干净.有什么建议吗?