I develop an iPhone app and I want to show the user a welcome screen on the first load of the app after installation.
That means that the next time the user will use my app he will not see that screen.Any ideas how to determine if this is the first load or not? (DB? File? Settings?)
开发者_StackOverflow社区Thanks!
I'd suggest writing a flag to NSUSerDefaults during the first run. Then you can check that flag during subsequent runs.
The "User Defaults Programming Guide for Cocoa" (included in the iPhone SDK documentation) is a good place to start.
The quick answer:
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"NotFirstStart"])
{
//show splash
[[NSUserDefaults standardUserDefaults]
setObject:@"YES" forKey:@"NotFirstStart"];
}
精彩评论