• UIActinSheet和UIActionSheetDelegate


    UIActinSheet和UIActionSheetDelegate

    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;
            }
        }
    }
  • 相关阅读:
    人生苦短我学Java-1-Helloword
    python-51-MySQLdb查询返回dict格式
    IDEA/PyCharm等系列-会了这些设置编码舒服而效率又提高了一截
    jacoco-2-jenkins集成代码测试覆盖率
    jacoco-1-java代码测试覆盖率之本地环境初体验
    wordpress 安装提示 Error Establishing a Database Connection
    mysql 8.0 重置 root 账户密码
    Ubuntu 20.04 卸载 snapd
    VSCode 扩展选择快捷键插件 Quick and Simple Text Selection
    Swagger 响应数据 response 里包含动态变化的对象 key 的方法
  • 原文地址:https://www.cnblogs.com/LiLihongqiang/p/5680483.html
Copyright © 2020-2023  润新知