Swift - 在手动转换后关闭最后一个View Controller

时间:2016-04-28 07:28:35

标签: swift

我正在构建一个应用程序,在8秒钟的静音之后,推送一个新的View Controller。过渡是交叉溶解(模态)。

新视图控制器具有模糊效果,仍显示最后一个视图控制器。而你得到了它,我只是不知道如何解雇最后一个。

我该怎么做?

//代码非常简单。

覆盖func viewDidLoad(){         super.viewDidLoad()

    NSTimer.scheduledTimerWithTimeInterval(8, target: self, selector: Selector("refreshApp"), userInfo: nil, repeats: false)

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func refreshApp (){
    self.performSegueWithIdentifier("refreshIdentifier", sender: self)
}

1 个答案:

答案 0 :(得分:0)

试试这段代码:

func refreshApp (){
        self.dismissViewControllerAnimated(true, completion: {
           self.performSegueWithIdentifier("refreshIdentifier", sender: self)
        })
}