Friday, 11 March 2011

Simple UIAlertView Use in IPhone

Define Delegate

UIAlertViewDelegate

then

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"message?"
delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
[alert show];
[alert release];

and

- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex (NSInteger)buttonIndex
{
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
NSLog(@"NO");
}
else
{
NSLog(@"YES");
}
}

No comments:

Post a Comment