ios - 模式转换后未调用 IBAction

标签 ios swift ios8 xcode6 ibaction

我的导航栏上有以下 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 ”的类: ViewHeirarchy

突出显示的 View 被命名为其他名称,直到我在身份检查器中将它改回 UIView:

identityInspector

希望对您或其他人有所帮助:)

关于ios - 模式转换后未调用 IBAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28404478/

相关文章:

ios - 隐藏 Firebase 崩溃报告

ios - 获取 CFAbsoluteTime 和 NSDate 之间的时间差

ios - UIImagePickerController 请求访问照片

ios - iOS7 多条件 pfquery 排序

javascript - React Native touchableopacity onpress 不起作用

ios - 如何从 iOS 钥匙串(keychain)中删除 KeyChainItemData 和 genericPasswordQuery 项目

iphone - 在 super 上调用协议(protocol)方法

arrays - 我如何使 Firebase 中的 .observe 在调用重新加载 Collection View 之前检索其所有数据

ios - 如何对静态单元格进行编程以从 Storyboard中获取高度,同时对其他单元格进行编程以从代码中获取高度

javascript - 如何在基于 iOS8 的设备中的输入字段内隐藏闪烁的插入符(管道)?