Я хочу перейти к контроллеру корневого представления, когда кто-то говорит «ОК» о действии предупреждения. Но действие Alert не позволяет получить доступ к себе.Как получить доступ к себе из UIAlertAction в Swift?
Что такое работа вокруг, чтобы получить текущую навигацию контроллер в AlertAction,
здесь код,
func buttonAction(sender:UIButton!)
{
let alertController = UIAlertController(title: "IQ", message:"Thank you for your feedback!", preferredStyle: .Alert)
alertController.addAction(okAction)
self.presentViewController(alertController, animated: true, completion: nil)
}
var okAction = UIAlertAction(title: "Menu", style:UIAlertActionStyle.Default) {
UIAlertAction in
NSLog("OK Pressed")
self.navigationController?.popToRootViewControllerAnimated(true) //error
}