Ios presentViewController()弹出最后一个视图后面的视图

Ios presentViewController()弹出最后一个视图后面的视图,ios,swift,uiviewcontroller,Ios,Swift,Uiviewcontroller,我试图在另一个故事板中执行到另一个UIViewController的转换,但问题是我要显示的视图会在我所在的视图后面弹出。 我知道这一点,因为我的应用程序在视图之间包含了类似Snapchat的导航,所以我可以将视图向左或向右拖动,然后可以看到后面的视图 以下是我如何尝试做到这一点: @IBAction func account(sender: UIButton) { if self._isOnline { self.pageController?.reverseViewC

我试图在另一个故事板中执行到另一个UIViewController的转换,但问题是我要显示的视图会在我所在的视图后面弹出。 我知道这一点,因为我的应用程序在视图之间包含了类似Snapchat的导航,所以我可以将视图向左或向右拖动,然后可以看到后面的视图

以下是我如何尝试做到这一点:

@IBAction func account(sender: UIButton) {
    if self._isOnline {
        self.pageController?.reverseViewControllerAnimated(true)
    }
    else {
        let alertView = UIAlertController(title: "blablablabla", message: "blablablabla", preferredStyle: .Alert)
        alertView.addAction(UIAlertAction(title: "No", style: .Cancel, handler: nil))
        alertView.addAction(UIAlertAction(title: "Yes", style: .Default, handler: { (alertAction) -> Void in
            let storyboard = UIStoryboard(name: "SignUpLogin", bundle: NSBundle.mainBundle())
            let vc = storyboard.instantiateInitialViewController() as! UIViewController
            self.presentViewController(vc, animated: false, completion: nil)
        }))
        presentViewController(alertView, animated: true, completion: nil)
    }
}
使用
SignUpLogin
这是我的第二个.storyboard文件的名称,我现在在
Heart.storyboard
中。 该操作发生在
UIAlertController
中,如果用户按no,nothing append,如果他按yes,他将被重定向到my
SignUpLogin.storyboard
文件的初始视图

我的问题来自左下角的视图。如果我在右上角的视图中使用上面的代码,那就行了!为什么?


我不知道如何才能做得不同。

我已经找到了解决问题的办法

    @IBAction func account(sender: UIButton) {
    if self._isOnline {
        self.pageController?.reverseViewControllerAnimated(true)
    }
    else {
        let alertView = UIAlertController(title: Constants.LocalizedJoinOurBand, message: Constants.LocalizedNeedToCreatAnAccount, preferredStyle: .Alert)
        alertView.addAction(UIAlertAction(title: Constants.LocalizedNo, style: .Cancel, handler: nil))
        alertView.addAction(UIAlertAction(title: Constants.LocalizedYes, style: .Default, handler: { (alertAction) -> Void in

            if let appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate {
                let storyboard = UIStoryboard(name: "SignUpLogin", bundle: NSBundle.mainBundle())
                let vc = storyboard.instantiateInitialViewController() as! UIViewController
                UIApplication.sharedApplication().keyWindow?.rootViewController = vc
            }
        }))
        presentViewController(alertView, animated: true, completion: nil)
    }
}
我不知道为什么会出现这种情况,但我必须使用以下行直接设置AppDelegate的
rootViewController

UIApplication.sharedApplication().keyWindow?.rootViewController = vc

你能展示一些屏幕截图来解释你需要什么吗?从你发布的代码来看,没有什么问题。您可以发布更多的代码或屏幕截图吗?请显示调用此代码的完整方法。@JAL谢谢,这里是更多代码和详细信息,对此表示抱歉。如果你想了解更多信息,请告诉我。@DookieMan好的,这不是来自这三行代码。。。我已经添加了完整的方法