标签:
//初始化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;
}
}
标签:
原文地址:http://www.cnblogs.com/kyuubee/p/4804976.html