UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"确定吗?" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"ok", nil];
[alertView show];
实现委托:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"click button index is: %i", buttonIndex);
}