專案 appdelegate.m 中“application:didFinishLaunchingWithOptions:” 方法 if (![[NSUserDefaults standardUserDefaults] boolForKey:@"everLaunched"]) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"everLaunched"]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstLaunch"];}else{ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"firstLaunch"];}
在程式需要判斷的部分加入以下代碼:
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { // 這裡判斷是否第一次 UIAlertView * alert =[[UIAlertView alloc] initWithTitle:@"第一次" message:@"進入App" delegate:self cancelButtonTitle:@"我知道了" otherButtonTitles:nil]; [alert show]; [alert release]; }
沒有留言:
張貼留言