• UIAlertView的使用方法


    // UIAlertView的常用方法

        // 标准样式

        UIAlertView *oneAlertView = [[UIAlertView alloc] initWithTitle:@"标题" message:@"提示内容" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:@"OK", nil];

        [oneAlertView show]; // 显示出来

        [oneAlertView release], oneAlertView = nil; // 释放内存

        oneAlertView.alertViewStyle = UIAlertViewStyleDefault; // 设置oneAlerView的样式

    // 按钮横排显示

        UIAlertView *twoAlertView = [[UIAlertView alloc] initWithTitle:@"标题" message:@"提示内容" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:@"按钮1", @"按钮2",@"按钮2", nil];

        [twoAlertView show]; // 显示出来

        [twoAlertView release], twoAlertView = nil; // 释放内存

    #pragma mark - 实现UIAlertView的代理方法判断按了哪个按钮

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

        // 获取您按下的是哪个按钮

        NSString* msg = [[NSString alloc] initWithFormat:@"您按下的第%d个按钮!",buttonIndex];

        NSLog(@"%@", msg);

        [msg release], msg = nil;

        // 点击“取消”,“按钮1”,“按钮2”,“按钮3”的索引buttonIndex分别是0,1,2,3

    }

     

     

     

        // 给UIAlertView添加其他

        UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"请等待"

                                                      message:nil

                                                     delegate:nil

                                            cancelButtonTitle:nil

                                            otherButtonTitles:nil];

        [alert show];

        UIActivityIndicatorView *activeView = [[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

        activeView.center = CGPointMake(alert.bounds.size.width/2.0f, alert.bounds.size.height-40.0f);

        [activeView startAnimating];

        [alert addSubview:activeView];

        [activeView release];

        [alert release];

  • 相关阅读:
    VMware Workstation9安装Mac OS X10.9系统
    如何在windows下的Python开发工具IDLE里安装其他模块?
    Git在下搭建下环境的工具
    Git的安装与使用
    Linux(CentOs6.4)安装Git
    VMware虚拟机上网络连接(network type)的三种模式--bridged、host-only、NAT
    centos 6.5 升级内核 linux 3.12.17
    让CentOS系统时间同步
    编译安装LNMP Centos 6.5 x64 + Nginx1.6.0 + PHP5.5.13 + Mysql5.6.19
    64位CentOS5.6安装Mysql 5.5.11GA
  • 原文地址:https://www.cnblogs.com/lhp-1992/p/4629761.html
Copyright © 2020-2023  润新知