【发布时间】:2015-02-09 07:07:56
【问题描述】:
我的导航栏上有以下 IBActions
@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 的视图控制器时,这一切正常。 但是,问题是当我执行模态/推送转换到所述视图控制器时,IBAction 没有被调用....
有什么想法吗?
【问题讨论】:
-
你推送和模态转换到同一个视图控制器?你的问题不清楚
-
我都试过了,因为我认为过渡可能有问题
标签: ios swift ios8 xcode6 ibaction