あなたはユーザーのデフォルト値が使用してオブジェクトを作成することができます
// Create an object reference to the NSUserDefaults class
let defaults = NSUserDefaults.standardUserDefaults()
あなたが要求し、決算やアプリを開くと、永続的になり、このNSUserDefaultsクラスのオブジェクトを設定することができます。
// Set a string for a key
defaults.setObject("a string", forKey: "myVar")
// Request the object associated with the key:
let myVar : String = defaults.stringForKey("myVar")
オブジェクトの保存時に値を保存して更新することができます。
// Create a reference to the Storyboard file
let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
// Create a reference to the ViewController you want to open
let vc : UIViewController = storyboard.instantiateViewControllerWithIdentifier("ID FROM NSUserDefaults")
// Present the ViewController
dispatch_async(dispatch_get_main_queue(), {
self.presentViewController(vc, animated: true, completion: nil)
})
これは良いですが、それが提示したときに、私はパートを置く場所を保存:あなたはビューコントローラのストーリーボードIDを保存する場合は、アプリを使用して表示されたときにアプリを起動すると、あなたはそれを再度開くことができたときに提示したいですviewController、viewDidLoad? – SwiftyJD
あなたの 'AppDelegate'の@SwiftyJD – kye