Reputation: 3240
I got an app with an UIAlertView
.
When this alertView close, i wanna implement some code. But i cant do it.
I connect UIAlertViewDelegate
and the write this methods:
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
NSLog(@"%i",buttonIndex);
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"%i",buttonIndex);
}
-(void)alertViewCancel:(UIAlertView *)alertView{
NSLog(@"cancel alert view");
}
But nothing typed in output. Why? Thnx.
UPD connection to UIAlertViewDelegate:
@interface PlaceListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, CLLocationManagerDelegate, UIAlertViewDelegate>
{
CLLocationManager *locationManager;
}
Upvotes: 0
Views: 1064
Reputation: 113747
Those method calls look fine, so it's probably a problem with how you set up your delegate. Are you setting delegate
to self
when you create the alert view?
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Ok"
message:@"Do action?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil] autorelease];
Upvotes: 3