【发布时间】:2016-02-18 23:49:20
【问题描述】:
好的,所以我添加了一个please wait 弹出窗口,用于在我的 ios 应用中花费比平时更长的操作。
我有一个从 ViewController 到 TabController 的 segue,当我像这样调用它时:
self.performSegueWithIdentifier("openMainApp", sender: self)
一切正常。
但是当我将它包围时:
let alert = UIAlertController(title: nil, message: "Please wait...", preferredStyle: .Alert)
alert.view.tintColor = UIColor.blackColor()
let loadingIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(10, 5, 50, 50)) as UIActivityIndicatorView
loadingIndicator.hidesWhenStopped = true
loadingIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
loadingIndicator.startAnimating();
alert.view.addSubview(loadingIndicator)
presentViewController(alert, animated: true, completion: nil)
self.performSegueWithIdentifier("openMainApp", sender: self)
dismissViewControllerAnimated(false, completion: nil)
然后我收到警告:
Warning: Attempt to present <app.TabController: 0x7ff6dc00bd40>
on <app.ViewController: 0x7ff6d9cf6600> which is already presenting
<UIAlertController: 0x7ff6d9d78530>
如何跳过此警告?
【问题讨论】:
标签: ios swift uiviewcontroller uialertcontroller