ios UIAlertView

UIAlertView *alert=[[[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:@"取消", nil] autorelease];
[alert show];

//alertView 按钮事件 在.h 文件加上UIViewController<UIAlertViewDelegate>
-(void)alertView:(UIAlertView *)theBackAlert clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSLog(@"%i", buttonIndex);
}

你可能感兴趣的:(ios UIAlertView)