您的位置:首页 > 产品设计 > UI/UE

iOS UIActionSheet的使用

2016-02-02 15:45 507 查看
一、初始化

- (IBAction)logout:(id)sender {
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"确定要注销?" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:nil, nil];
[sheet showInView:self.view];
}


二、设置代理

//必须要让控制器遵守UIActionSheetDelegate代理

#pragma mark - actionsheet的代理方法
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
//通过buttonIndex的值来确定点击的是第几个
if (buttonIndex == 0){

NSLog(@"确定注销");

}
}


三、效果图

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: