码迷,mamicode.com
首页 > 其他好文 > 详细

UIActionSheet

时间:2015-09-13 15:59:00      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

//初始化actionsheet,并设置相关属性
    UIActionSheet *actionsheet=[[UIActionSheet alloc]initWithTitle:@"hello" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"删除" otherButtonTitles:@"选项一",@"选项二", nil];
    //设置actionsheet的属性
    actionsheet.actionSheetStyle=UIActionSheetStyleBlackTranslucent;
    /*
     UIActionSheetStyleAutomatic
     UIActionSheetStyleDefault
     UIActionSheetStyleBlackTranslucent
     UIActionSheetStyleBlackOpaque
     */
    //显示actionsheet
    [actionsheet showInView:self.view];

 

 

//UIActionSheet协议方法
//判断点击的按钮
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    switch (buttonIndex) {
        case 3:
            NSLog(@"取消");
            break;
            case 0:
            NSLog(@"删除");
            break;
            case 1:
            NSLog(@"选项一");
            break;
            case 2:
            NSLog(@"选项二");
            break;
        default:
            break;
    }
}

 

UIActionSheet

标签:

原文地址:http://www.cnblogs.com/kyuubee/p/4804976.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!