UIAlertView用来显示一个对话框,可以设置对话框的标题、文案、按钮的个数和文案,也可以通过实现delegate来监听按钮的的点击操作。

使用UIAlertView时需要注意:

self.alertView = [[UIAlertView alloc]
initWithTitle:@"警告"
message:@"警告你,作为男人必须负责,必须努力!"
delegate:self
cancelButtonTitle:@"取消"
//注意:otherButtonTitles可以接收多个字符串作为参数(直到遇到nil终止)
otherButtonTitles:@"我是男人",@"我是女人",@"我是小孩", nil];

UIActivityIndicatorView就是大家耳熟能详的“转菊花”,使用该控件时需要注意:

1.该控件的高度和宽度无法改变(不同样式的菊花大小也不一样);

2.调用addSubView之后该控件也是不可见的,除非调用startAnimating

- (void) btnClicked : (UIButton*) btn {
int tag = (int)btn.tag;
if (tag == 101) {
self.alertView = [[UIAlertView alloc] initWithTitle:@"警告" message:@"警告你,作为男人必须负责,必须努力!" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"我是男人",@"我是女人",@"我是小孩", nil]; [self.alertView show];
} else if (tag == 102) {
self.indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.indicatorView.frame = CGRectMake(100, 100, 80, 80);
[self.view addSubview:self.indicatorView]; [self.indicatorView startAnimating];
}
}

  

UIAlertView和UIActivityIndicatorView的使用的更多相关文章

  1. UIAlertView/UIAlertController封装使用

    基于UIAlertView封装的JXTAlertView,这个是将之前写Demo时搞的一套快捷使用alertView的工具抽离整理出来的,并提供了C函数直接调用,像这样: jxt_showAlertT ...

  2. iPhone与iPad开发实战读书笔记

    iPhone开发一些读书笔记 手机应用分类1.教育工具2.生活工具3.社交应用4.定位工具5.游戏6.报纸和杂志的阅读器7.移动办公应用8.财经工具9.手机购物应用10.风景区相关应用11.旅游相关的 ...

  3. IOS开发UI基础 UIAlertView的属性

    UIAlertView1.Title获取或设置UIAlertView上的标题. 2.Message获取或设置UIAlertView上的消息 UIAlertView *alertView = [[UIA ...

  4. UIAlertView

    1.Title 获取或设置UIAlertView上的标题. 2.Message 获取或设置UIAlertView上的消息 UIAlertView *alertView = [[UIAlertViewa ...

  5. UIAlertView用法

    1. 最简单的用法 UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"这是一个简 ...

  6. UIAlertView的使用方法

    UIAlertView的使用方法 1. 最简单的用法 UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"提示" mes ...

  7. IOS 警告框 (UIAlertView)的使用方法

    1.普通警告框 IOS的SDK中提供了一个方便的类库UIAlertView,配合着不同参数来使用此类可以做出大多数的警告框,如下代码是IOS最简单的警告框. UIAlertView *alert = ...

  8. IOS开发:UIAlertView使用

    链接地址:http://www.2cto.com/kf/201307/231841.html UIAlertView是什么就不介绍了 1.基本用法 1 UIAlertView *view = [[UI ...

  9. 自定义的UIAlertView不能在iOS7上正常显示

    众所周知,当伟大的iOS7系统发布后,表扬的一堆.谩骂的也一片,而对于我们程序员来说最关心的莫过于低版本系统上的程序在搞版本系统上的兼容性问题了. 在iOS6.1几之前,当我们想要做一些提醒用户或临时 ...

随机推荐

  1. 输入两个正整数m和n,求其最大公约数和最小公倍数

    public static void main(String[] args){  Scanner sc = new Scanner (System.in);  int a,b;  System.out ...

  2. 微软Face API体验——人脸检测

    微软推出了全新REST API,现在可免费获取密钥,大家可以赶快申请!申请地址:https://cn.projectoxford.ai/subscription 看了网站的API介绍,忍不住赶快体验一 ...

  3. Disable the screen switching about VI

    If you want to disable the screen switching, and you don't want tochange your termcap, you can add t ...

  4. 向通知栏发送通知点击跳转并传递数据(PendingIntent)传递数据

    // 为发送通知的按钮的点击事件定义事件处理方法 public void send() {///// 第一步:获取NotificationManager NotificationManager nm ...

  5. 10大白帽黑客专用的 Linux 操作系统

    原文出处: Irshad Pathoor   译文出处:Linux中国   欢迎分享原创到伯乐头条 今天让我们来介绍十个黑客专用的操作系统,它们被白帽黑客用作渗透测试的工具.这里我把 Kali Lin ...

  6. HTML核心元素

    一 HTML核心元素 1.文本标题 <h1>一级标题</h1> <h2>二级标题</h2> <h3>三级标题</h3> ... ...

  7. vfp 智能感知拓展应用

    *======================================================================================== * * Versio ...

  8. Android HandlerThread 的使用及其Demo (转)

    转自http://www.cnblogs.com/hnrainll/p/3597246.html 介绍 首先我们来看看为什么我们要使用HandlerThread?在我们的应用程序当中为了实现同时完成多 ...

  9. Bootstrap模态弹出窗

    Bootstrap模态弹出窗有三种方式: 1.href触发模态弹出窗元素: <a class="btn btn-primary" data-toggle="moda ...

  10. S2SH+mysql-软件开发实际部署问题-8个小时后提示MYSQL数据库无法连接

    type Exception report message description The server encountered an internal error () that prevented ...