当前位置:首页 > 操作系统 > Ios

iOS学习-UIActionSheet详解

             1
            //
             2
            //
              ViewController.m

             3
            //
              UIActionSheet详解

             4
            //
             5
            //
              Created by 大欢 on 16/1/25.

             6
            //
              Copyright ? 2016年 bjsxt. All rights reserved.

             7
            //

             8
             9
            #import
            "
            ViewController.h
            "
            10
            11
            @interface ViewController ()<UIActionSheetDelegate>
1213 - (IBAction)showActionSheet:(id)sender;
1415@end1617@implementation ViewController
1819 - (void)viewDidLoad {
20    [super viewDidLoad];
2122}
2324 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
2526switch (buttonIndex) {
27case0:
28             NSLog(@"确定");
29break;
30case1:
31             NSLog(@"可以");
32break;
33case2:
34             NSLog(@"取消");
35break;
36default:
37break;
38    }
3940}
4142 - (IBAction)showActionSheet:(id)sender {
4344     UIActionSheet * sheet = [[UIActionSheet alloc] initWithTitle:@"题目"delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:@"可以", nil];
4546    [sheet showInView:self.view];
4748     [self performSelector:@selector(dismissActionSheet:) withObject:sheet afterDelay:5];
4950}
5152 - (void)dismissActionSheet:(UIActionSheet *)sheet {
5354     [sheet dismissWithClickedButtonIndex:0 animated:YES];
55}
565758@end

技术分享

原文:http://www.cnblogs.com/MrWuYindi/p/5158886.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!