//Event created alert
let alert = UIAlertController(title: "Event Created", message: "Event successfully created", preferredStyle: UIAlertControllerStyle.Alert);
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler:nil));
self.presentViewController(alert, animated: true, completion: nil);
//Pop back to table
self.navigationController!.popToRootViewControllerAnimated(true);
在此代碼中,我創建了一個警報,並直接在警報之後使用popToRootViewControllerAnimated方法。這不起作用的原因,我發現的解決方法是調用presentViewController完成內部的方法。爲什麼popviewcontroller在alertview之後的presentviewcontroller之後工作?
爲什麼pop方法在presentViewController方法之後不起作用,除非將其放入閉包中?