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

UIActinSheet和UIActionSheetDelegate

时间:2016-07-18 18:54:20      阅读:464      评论:0      收藏:0      [点我收藏+]

标签:

UIActinSheet和UIActionSheetDelegate

技术分享

这个是就那个UIActionSheet对象  一般用来选择类型或者改变界面。。。还有更多应用

定义如下:
UIActionSheet *styleAlert = [[UIActionSheet alloc] initWithTitle:@"Choose a UIBarStyle:"
                                                delegate:self cancelButtonTitle:@"Cancel"
                                               destructiveButtonTitle:nil
                                               otherButtonTitles:  @"Default",
                                                                   @"BlackOpaque",
                                                                   @"BlackTranslucent",
                                                                   nil,
                                                                   nil];
   
    // use the same style as the nav bar
    styleAlert.actionSheetStyle = self.navigationController.navigationBar.barStyle;
    //styleAlert.actionSheetStyle =UIActionSheetStyleAutomatic;
    [styleAlert showInView:self.view];
    [styleAlert release];

在委托里的操作代码如下:
- (void)actionSheet:(UIActionSheet *)modalView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    // Change the navigation bar style, also make the status bar match with it
    switch (buttonIndex)
    {
        case 0:
        {
            [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
            self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
            break;
        }
        case 1:
        {
            [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
            self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
            break;
        }
        case 2:
        {
            [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
            self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
            break;
        }
    }
}

UIActinSheet和UIActionSheetDelegate

标签:

原文地址:http://www.cnblogs.com/LiLihongqiang/p/5680483.html

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