Per visualizzare un UIAlertView al primo avvio di una app, potete utilizzare il seguente codice. Utilizziamo un NSUserDefaults per memorizzare un BOOL che conterrà YES dopo il primo avvio.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
-(void) showFirstRunAlerts { BOOL ranBefore = [[NSUserDefaults standardUserDefaults] boolForKey:@"RanBefore"]; if (!ranBefore) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Titolo Messaggio." message:@"Messaggio." delegate:self cancelButtonTitle:@"Grazie!" otherButtonTitles:nil]; [alert show]; [alert release]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RanBefore"]; [[NSUserDefaults standardUserDefaults] synchronize]; } } |
enjoy!
Se hai trovato utili le informazioni su questo blog,
Fai una donazione!
Clicca sul bottone qui sotto o almeno clicca sul banner pubblicitario 🙂
Commenta