I am trying to call and alert when a button is pressed. i use this :
-(IBAction)Add {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @\"add bu
1)
.h file
@interface MyClassViewController:
2)
.m file
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Note"
message:@"some message"
delegate:self // must be self to call clickedButtonAtIndex
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
3)
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == [alertView cancelButtonIndex]) {
NSLog(@"The cancel button was clicked from alertView");
}
else {
}
}