我的导航栏上有以下 IBAction
@IBAction func logoutPressed(sender: AnyObject) {
SweetAlert().showAlert("Are you sure?", subTitle: "Do you really want to logout?", style: AlertStyle.Warning, buttonTitle:"Cancel", buttonColor:UIColorFromRGB(0xD0D0D0) , otherButtonTitle: "Yep", otherButtonColor: UIColorFromRGB(0xDD6B55)) { (isOtherButton) -> Void in
if isOtherButton == false {
let popTime = dispatch_time(DISPATCH_TIME_NOW, Int64( Double(NSEC_PER_SEC) * 4.0 ))
SwiftSpinner.show("Logging out")
dispatch_after(popTime, dispatch_get_main_queue(), {
PFUser.logOut()
self.performSegueWithIdentifier("logoutSegue", sender: nil)
SwiftSpinner.hide()
})
}
else {
}
}
}
//OPTIONS MENU
@IBAction func optionsPressed(sender: AnyObject) {
let alert = SCLAlertView()
alert.addButton("Submit Feedback"){
var subjectText = "feedback"
var toRecipient = ["some email address"]
var mc:MFMailComposeViewController = MFMailComposeViewController()
mc.mailComposeDelegate = self
mc.setSubject(subjectText)
mc.setToRecipients(toRecipient)
self.presentViewController(mc, animated: true, completion: nil)
}
alert.addButton("About") {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("about") as UIViewController
self.presentViewController(vc, animated: true, completion: nil)
}
等等....
当我将应用程序启动到包含这些 IBAction 的 View Controller 时,这工作得很好。 然而,问题是当我执行模式/推送转换到所述 View Controller 时,IBAction 没有被调用....
有什么想法吗?
最佳答案
我也刚刚处理过这个问题,可能不是一个通用的解决方案,因为对我来说这是一个愚蠢的错误,但问题是我已经更改了 ViewController 中“ View ”的类:
突出显示的 View 被命名为其他名称,直到我在身份检查器中将它改回 UIView:
希望对您或其他人有所帮助:)
关于ios - 模式转换后未调用 IBAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28404478/