Problem with UIAlertView?

Define each UIAlertView and in the delegate look for which Alert to respond to.

Define each UIAlertView and in the delegate look for which Alert to respond to: -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if(alert1) { if (buttonIndex==0) { NSLog(@"NO"); } else { NSLog(@"Yes"); UIAlertView *alert = UIAlertView alloc initWithTitle:@"Alert" message:@"Do you want's to receive Push messages. " delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil; alert show; alert release; } } else { /* the second alertview using the same buttonIndex */ } }.

Kiran this is the way when you code for both alert button code(In case you need to perform any action on click of second alert). – Ishu Dec 16 '10 at 4:45.

Set delegate:nil in second alertView I mean if (buttonIndex==0) { NSLog(@"NO"); } else { NSLog(@"Yes"); UIAlertView *alert = UIAlertView alloc initWithTitle:@"Alert" message:@"Do you want's to receive Push messages. " delegate:nil cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil; alert show; alert release; }.

1 for catching right thing at right place. – Ishu Dec 16 '10 at 4:43.

If what you want is to receive the location, just request it and the system will automatically show the message for you. Follow this example: - (void)applicationDidFinishLaunching:(UIApplication *)application { window addSubview:tabBarController. View; // Create a location manager instance to determine if location services are enabled.

This manager instance will be // immediately released afterwards. CLLocationManager *manager = CLLocationManager alloc init; if (manager. LocationServicesEnabled == NO) { UIAlertView *servicesDisabledAlert = UIAlertView alloc initWithTitle:@"Location Services Disabled" message:@"You currently have all location services for this device disabled.

If you proceed, you will be asked to confirm whether location services should be reenabled. " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil; servicesDisabledAlert show; servicesDisabledAlert release; } manager release; } http://developer.apple.com/library/ios/#samplecode/LocateMe/Listings/Classes_AppDelegate_m.html%23//apple_ref/doc/uid/DTS40007801-Classes_AppDelegate_m-DontLinkElementID_4 Same for push notifications.

Though you got many implementation solutions already ...but I think better practice would be to assign a tag to each of your AlertView and before detecting the button tapped check the tag of invoking AlertView. Hope this helps. @Gerard:Though both location manager and push notification service raise system generated messages ,these can be checked off by users not to be shown again.So better HIG complaint method is application generating message whenever push or location manager are required.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions