Quote:
Originally Posted by pete42
I really have no idea how to do this. i have a settings bundle which changes stuff in my app but i cant do the opposite.
heres how it is, i have a toggle in settings and i can toggle it and it changes stuff in the app.
but i also have an alertview that pops up only once at the beginning and it should update the settings toggle but i dont know how.
so app launches, alertview shows up, tap yes or no.
yes = 1, no = 0.
that is what doesnt work.
any ideas?
|
Code:
if (//check for first run by checking for and making nonexistent variable in userdefaults)
UIAlertView *settingsAlert = [[UIAlertView alloc] initWithTitle:@"Message here " delegate:self cancelButtonTitle:nil otherButtonTitles:@"Yes", @"No Tilts", nil];
[settingsAlert show];
[settingsAlert release];
-(void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
{
//Set settings value to 0
}
if (buttonIndex == 1)
{
//Set settings value to 1
}
}
I didn't test the code above, but as long as you can fill up the comments part with the actual code(google), it should work.