Ensure the header file contains the following:
Code:
@interface YourViewController : UIViewController
Code:
- (void)alertOKCancelAction {
// open a alert with an OK and cancel button
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
}
Code:
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1)
{
NSLog(@"User clicked OK");
} else {
NSLog(@"User clicked Cancel");
}
}
Reference: Stitch@iphonedevsdk.com
No comments:
Post a Comment