首页 > 移动平台 > 详细

iOS UIActionSheet的使用

时间:2016-02-02 16:20:07      阅读:150      评论:0      收藏:0      [点我收藏+]

一、初始化

- (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(@"确定注销");

         }

}

三、效果图

技术分享

iOS UIActionSheet的使用

原文:http://www.cnblogs.com/yumian/p/5177726.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!