iPhone开发 uialertview 确定与取消

//按钮事件

-(IBAction)btnRead

{   

    UIAlertView* a=[[UIAlertViewalloc]init];

    a=[[UIAlertViewalloc] initWithTitle:@"b"message:@"s"delegate:selfcancelButtonTitle:@"确定"otherButtonTitles: @"取消",nil];    

    [a show]; 

}

//定义的委托,buttonindex就是按下的按钮的index值

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    NSLog(@"%i",buttonIndex);

}

posted @ 2012-02-28 14:12  凡娃软件  阅读(1530)  评论(0)    收藏  举报