NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
 if (![prefs objectForKey:@"alert"]) { 
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"this is 1st time" message:@"Some description"
                delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
  [alert show];
  [alert release];
  [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"alert"];
 }
 else {
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@" this is 2nd time!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; 
  NSLog(@" DEJA VU");
 }
 [[NSUserDefaults standardUserDefaults] synchronize];
 
 
No comments:
Post a Comment