UIAlertView

来源:互联网 发布:日本j2联赛网络直播 编辑:程序博客网 时间:2024/05/16 23:57

基本属性

1.initWithTitle:设置标题

2.delegate:设置Alert的委托, 设成self



 //提醒视图(UIAlerView的创建)

        //1.创建

        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"标题" message:@"信息" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",@"其他信息", nil];

        

        //2.显示

        [alertView show];

        [alertView release];


//alertView的协议方法

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

{

    //默认的取消按钮  buttonIndex为0

    //其他按钮依次为1 2 3 。。。

    NSLog(@"%ld", (long)buttonIndex);

    if (1 == buttonIndex) {

        NSLog(@"确定");

    }

    

}



0 0
原创粉丝点击