I have some regular alert views and a custom alert view called ‘UINotificationAlertView’
I want the ‘ok’ button click event on the custom UINotificationAlertView to use the second method and not the first. How can I do this? Im new to objective c so sorry if this is a dumb question.
UINotificationAlertView *message = [[UINotificationAlertView alloc]
initWithTitle:@""
message:row.alertBody
delegate:self.
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
Both methods in App delgate:
//UIAlertView delegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex == kNo) {
} else {
//Close by suspending...
[[UIApplication sharedApplication] suspend];
}
}
- (void)alertNotificationView:(UINotificationAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"phils new delegate");
if(buttonIndex == kNo) {
} else {
//Close by suspending...
[[UIApplication sharedApplication] suspend];
}
}
try
In your .h file, enter:
In your .m file:
message.delegate = self;