b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

ios web markup iOS 9学习系列:Search API(3)

电脑杂谈  发布时间:2017-06-08 09:05:39  来源:网络整理

func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
    let splitController = self.window?.rootViewController as! UISplitViewController
    let navigationController = splitController.viewControllers.first as! UINavigationController
    navigationController.topViewController?.restoreUserActivityState(userActivity)
    return true
}

接下来,在MasterViewController类里实现restoreUserActivityState方法:

override func restoreUserActivityState(activity: NSUserActivity) {
    if let name = activity.userInfo?["name"] as? String,
        let genre = activity.userInfo?["genre"] as? String,
        let time = activity.userInfo?["time"] as? NSDate {
        let show = Show(name: name, genre: genre, time: time)
        self.showToRestore = show
         
        self.performSegueWithIdentifier("showDetail", sender: self)
    }
    else {
        let alert = UIAlertController(title: "Error", message: "Error retrieving information from userInfo:\n\(activity.userInfo)", preferredStyle: .Alert)
        alert.addAction(UIAlertAction(title: "Dismiss", style: .Cancel, handler: nil))
         
        self.presentViewController(alert, animated: true, completion: nil)
    }
}


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-51781-3.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...