1. UIAlertView *alertView = [[UIAlertView alloc]
  2. initWithTitle:@"Alert"
  3. message:@"You've been delivered an alert"
  4. delegate:nil
  5. cancelButtonTitle:@"Cancel"
  6. otherButtonTitles:@"Ok", nil];
  7. [alertView show];

self.view.backgroundColor = [UIColor whiteColor];

  1. NSString *message = @"Are you sure you want to open this link in Safari?";
  2. UIAlertView *alertView = [[UIAlertView alloc]
  3. initWithTitle:@"Open Link"
  4. message:message
  5. delegate:self
  6. cancelButtonTitle:[self noButtonTitle]
  7. otherButtonTitles:[self yesButtonTitle], nil];
  8. [alertView show];

more samples

  1. // one button alert
  2. UIAlertView *alert =
  3. [[UIAlertView alloc]
  4. initWithTitle: @"Hello"
  5. message: @"Hello Master HaKu!"
  6. delegate: self
  7. cancelButtonTitle: @"OK"
  8. OtherButtonTitles: nil];
  9. [alert show];
  10. [alert release];
  11.  
  12. // two buttons alert
  13. UIAlertView *alert =
  14. [[UIAlertView alloc]
  15. initWithTitle: @"Hello"
  16. message: @"Hello Master HaKu!"
  17. delegate: self
  18. cancelButtonTitle: @"YES"
  19. OtherButtonTitles: @"NO", nil];
  20. [alert show];
  21. [alert release];
  22.  
  23. // more buttons alert
  24. UIAlertView *alert =
  25. [[UIAlertView alloc]
  26. initWithTitle: @"Hello"
  27. message: @"Hello Master HaKu!"
  28. delegate: self
  29. cancelButtonTitle: @"OK"
  30. OtherButtonTitles: @"Option1", @"Option2", nil];
  31. [alert show];
  32. [alert release];
  33.  
  34. @interface AlertTestViewController : UIViewController<UIAlertViewDelegate>
  35.  
  36. @end
  37.  
  38. // alert click implmentation
  39. - (void) alertView: (UIAlertView *)alertView
  40. clickedButtonAtIndex: (NSInteger)buttonIndex
  41. {
  42. NSLog(@"%d", buttonIndex);
  43. }

Displaying Alerts with UIAlertView的更多相关文章

  1. Cannot find executable for CFBundle 解决办法

    出错日志为:2013-12-29 01:17:49.785 Displaying Alerts with UIAlertView[419:70b] Cannot find executable for ...

  2. 开始使用 UIAlertController 吧

    UIAlertView 与 UIActionSheet UIAlertView 样式 实现 - (void)showAlertView { self.alertView = [[UIAlertView ...

  3. learning shell display alert function

    [Purpose]        Shell print function base on err info wrn ext output level   [Eevironment]        U ...

  4. IOS Using UIAlertView to show alerts

    UIAlertView in other words, it's a dialog box. You want to show a message or ask user to confirm an ...

  5. UIAlertController (UIActionSheet, UIAlertView is deprecated in iOS 8.)

    iOS 8 后 UIAlertView 和  UIActionSheet 都被合并到了 UIAlertController里面. 文档原文: Important: UIAlertView is dep ...

  6. [Swift]UIKit学习之警告框:UIAlertController和UIAlertView

    Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated.) T ...

  7. iOS 8及以后版本 如何创建UIAlertView?

    1. Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated. ...

  8. iOS8以后UIAlertView和UIActionSheet两种alert页面都将通过UIAlertController来创建

    1. Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated. ...

  9. iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)

     本文转载至 http://blog.csdn.net/liuwuguigui/article/details/39494597       IOS8UIAlertViewUIActionSheet ...

随机推荐

  1. POJ 1860 Currency Exchange

    题意:有n种货币,可以互相兑换,有m个兑换规则,兑换规则给出汇率r和手续费c,公式为b = (a - c) * r,从a货币兑换为b货币,问能不能通过不断的兑换赚钱,兑换期间手中的钱数不可以为负. 解 ...

  2. 浅谈Linux容器和镜像签名

    导读 从根本上说,几乎所有的主要软件,即使是开源软件,都是在基于镜像的容器技术出现之前设计的.这意味着把软件放到容器中相当于是一次平台移植.这也意味着一些程序可以很容易就迁移,而另一些就更困难. 我大 ...

  3. IOS GCD

    UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)]; [btn setTitle:@&quo ...

  4. C++第一章概述

    1:C++主要是对于C的继承性做的相当的出色,主要扩充在于程序员可以自己定义自己的数据结构,用数据结构去描述日常生活中的事务,而不是C语言中当当仅有的Struct数据类型等等 2: 每一种语言都有自己 ...

  5. springmvc基础知识

    springmvc框架,类似于struts,主要用于MVC的控制层 spring的简单配置(非注解):  spring-mvc.xml文件(springMVC框架的基本文件) web.xml文件 ja ...

  6. 数字图像处理-----主成成分分析PCA

    主成分分析PCA 降维的必要性 1.多重共线性--预测变量之间相互关联.多重共线性会导致解空间的不稳定,从而可能导致结果的不连贯. 2.高维空间本身具有稀疏性.一维正态分布有68%的值落于正负标准差之 ...

  7. Maven解决Missing artifact com.sun:tools:jar:1.5.0错误

    <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> ...

  8. 树莓派I2C连接18B20

    按图连接设备 载入模块 sudo modprobe w1-gpio sudo modprobe w1-therm cd /sys/bus/w1/devices/ 显示结果 ls pi@raspberr ...

  9. 【Spark学习】Apache Spark监控与测量

    Spark版本:1.1.1 本文系从官方文档翻译而来,转载请尊重译者的工作,注明以下链接: http://www.cnblogs.com/zhangningbo/p/4137952.html

  10. 【Hadoop代码笔记】Hadoop作业提交之Child启动reduce任务

    一.概要描述 在上篇博文描述了TaskTracker启动一个独立的java进程来执行Map任务.接上上篇文章,TaskRunner线程执行中,会构造一个java –D** Child address ...