Skip to content
Guest Big Announcement

Help with UIAlertView in Settings

Featured Replies

Hello, all.

I am trying to show a UIAlertView in the settings when the user toggles a switch on for the first time. It should only show up once and never again for that certain switch.

I did manage to implement this, however, the alert was too slow in showing up and sometimes it showed up like 2 minutes later.

I would like it to show up instantly.

 

part of test.mm:

 -(void)alert {

NSUserDefaults *validate = [NSUserDefaults standardUserDefaults];
    NSString *alreadyRun = @"already_run";
    if ([validate boolForKey:alreadyRun])  
    return;
    [validate setBool:YES forKey:alreadyRun];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Title"
    message:@"Test Message" delegate:nil cancelButtonTitle:@"Close Test Pop-Up"
    otherButtonTitles:nil];
    [alert show];
    [alert release];
}
@end

part of test.plist:

<dict>
			<key>action</key>
			<string>alert</string>
			<key>cell</key>
			<string>PSSwitchCell</string>
			<key>default</key>
			<false/>
			<key>defaults</key>
			<string>test.com</string>
			<key>key</key>
			<string>test1</string>
			<key>label</key>
			<string>Test Label</string>
		</dict>

thanks

Updated by Astronaut

  • Author

well just found out tapping the cell that the switch is on invokes the UIAlert.

I would still like to know how to implement it when the user toggles it on.

 

i need this is for extra info on the switch. It will show an alert with more info on that certain switch.

Updated by Astronaut

Create an account or sign in to comment

Featured Content

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.