UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Alert"
message:@"You've been delivered an alert"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Ok", nil];
[alertView show];

self.view.backgroundColor = [UIColor whiteColor];

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

more samples

// one button alert
UIAlertView *alert =
[[UIAlertView alloc]
initWithTitle: @"Hello"
message: @"Hello Master HaKu!"
delegate: self
cancelButtonTitle: @"OK"
OtherButtonTitles: nil];
[alert show];
[alert release]; // two buttons alert
UIAlertView *alert =
[[UIAlertView alloc]
initWithTitle: @"Hello"
message: @"Hello Master HaKu!"
delegate: self
cancelButtonTitle: @"YES"
OtherButtonTitles: @"NO", nil];
[alert show];
[alert release]; // more buttons alert
UIAlertView *alert =
[[UIAlertView alloc]
initWithTitle: @"Hello"
message: @"Hello Master HaKu!"
delegate: self
cancelButtonTitle: @"OK"
OtherButtonTitles: @"Option1", @"Option2", nil];
[alert show];
[alert release]; @interface AlertTestViewController : UIViewController<UIAlertViewDelegate> @end // alert click implmentation
- (void) alertView: (UIAlertView *)alertView
clickedButtonAtIndex: (NSInteger)buttonIndex
{
NSLog(@"%d", buttonIndex);
}

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. 应用emailAutoComplete.js来自动显示邮箱后缀列表

    我们经常有邮箱的人都特别清楚,在输入我们的邮箱时,会自动显示出邮箱后缀列表,这个用户体验是不错的. 操作据悉——当我们输入文字时,会自动有个邮箱后缀名的列表.      而我这边的代码是,应用jque ...

  2. FTP文件上传与下载

    实现FTP文件上传与下载可以通过以下两种种方式实现(不知道还有没有其他方式),分别为:1.通过JDK自带的API实现:2.通过Apache提供的API是实现. 第一种方式:使用jdk中的ftpClie ...

  3. 接入脚本interface.php实现代码

    承接上文的WeChatCallBack 在WeChatCallBack类的成员变量中定义了各种消息都会有的字段,这些字段在init函数中赋值.同时也把解析到的XML对象作为这个类的成员变量$_post ...

  4. 为duilib的MenuDemo增加消息响应,优化代码和显示效果

    转载请说明原出处,谢谢~~:http://blog.csdn.net/zhuhongshu/article/details/38253297 第一部分 我在前一段时间研究了怎么制作duilib的菜单, ...

  5. android开发的学习路线(转)

    第一阶段:Java面向对象编程 1.Java基本数据类型与表达式,分支循环. 2.String和StringBuffer的使用.正则表达式. 3.面向对象的抽象,封装,继承,多态,类与对象,对象初始化 ...

  6. HDU-4734 F(x) 数位DP

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4734 注意到F(x)的值比较小,所以可以先预处理所有F(x)的组合个数.f[i][j]表示 i 位数时 ...

  7. ERROR (ClientException): Unexpected API Error

  8. 信息图:iOS 7开发者需要知道的事

      如果你想为iOS 设备开发app,你需要知道如何与软件交互,如何设计,你还要知道苹果独特的开发理念和开发工具.真正的能力还需要成功地从其他行业领域借鉴核心概念.最后把所有这些东西糅合进你的信息库中 ...

  9. JavaWeb应用中重定向与跳转的区别

    针对JSP与Servlet: 两种重要的跳转: 1.request.getRequestDispatcher("地址").forward(ServletRequest, Servl ...

  10. Java设计模式系列之策略模式

    策略模式的定义: 策略模式定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换,策略模式让算法独立于使用它的客户而独立变化. 策略模式使这些算法在客户端调用它们的时候能够互不影响地变化 ...