UIAlertView 提示用户  帮助用户选择框

//    UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"警告" message:@"你还没把信息填完" delegate:nil  cancelButtonTitle:@"cancle" otherButtonTitles:@"确认",  nil];

//    [alterView show];

//    [alterView release];

AlterView *alterView = [[AlterView alloc] initWithTitle:@"警告" message:@"你还没把信息填完" delegate:self

cancelButtonTitle:@"cancle" otherButtonTitles:@"确认",@"再次确认" , nil];

alterView.tag=identifier;

[alterView release];

identifier++;

/**

title:视图标题

delegate:设置代理

cancelButtonTitle:取消按钮的标题

destructiveButtonTitle:特殊标记的按钮的标题

otherButtonTitles:其他按钮的标题

*/

UIActionSheet *actionSheet =[[UIActionSheet alloc]initWithTitle:@"提示" delegate:self  cancelButtonTitle:@"cancel" destructiveButtonTitle:@"标题” //强调的 otherButtonTitles:@"选择1", @"选择2",@"选择3",nil];

[actionSheet showInView:self.window];

[actionSheet release];

二、常用方法和属性介绍

@property(nonatomic,copy) NSString *title;

设置标题

@property(nonatomic) UIActionSheetStyle actionSheetStyle;

设置风格,枚举如下:

1
2
3
4
5
6
typedef NS_ENUM(NSInteger, UIActionSheetStyle) {
    UIActionSheetStyleAutomatic        = -1,      
    UIActionSheetStyleDefault          = UIBarStyleDefault,
    UIActionSheetStyleBlackTranslucent = UIBarStyleBlackTranslucent,
    UIActionSheetStyleBlackOpaque      = UIBarStyleBlackOpaque,
};

- (NSInteger)addButtonWithTitle:(NSString *)title;

添加一个按钮,会返回按钮的索引

- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;

获取按钮标题

@property(nonatomic,readonly) NSInteger numberOfButtons;

获取按钮数量

@property(nonatomic) NSInteger cancelButtonIndex;

设置取消按钮的索引值

@property(nonatomic) NSInteger destructiveButtonIndex;

设置特殊标记

@property(nonatomic,readonly,getter=isVisible) BOOL visible;

视图当前是否可见

下面是几种弹出方式,会根据风格不同展现不同的方式

- (void)showFromToolbar:(UIToolbar *)view;

- (void)showFromTabBar:(UITabBar *)view;

- (void)showFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated ;

- (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated ;

- (void)showInView:(UIView *)view;

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;

使用代码将视图收回

三、UIActionSheet代理方法

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;

点击按钮时触发的方法

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet;

视图将要弹出时触发的方法

- (void)didPresentActionSheet:(UIActionSheet *)actionSheet;

视图已经弹出式触发的方法

- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex;

点击按钮后,视图将要收回时触发的方法

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex;

点击按钮后,视图已经收回时触发的方法

UIAlertView 与 UIActionSheet (提示用户)的使用方法的更多相关文章

  1. 关于微信小程序发布新版本后的提示用户更新的方法详解

    当小程序发布新的版本后 ,用户如果之前访问过该小程序,通过已打开的小程序进入(未手动删除),则会检测新版本,提醒用户更新新的版本 话不多说,上代码 App({ onLaunch: function ( ...

  2. 写给大忙人的centos下ftp服务器搭建(以及启动失败/XFTP客户端一直提示“用户身份验证失败”解决方法)

    注:个人对偏向于底层基本上拿来就用的应用,倾向于使用安装包,直接yum或者rpm安装:而对于应用层面控制较多或者需要大范围维护的,倾向于直接使用tar.gz版本. 对于linux下的ftp服务器,实际 ...

  3. ESXI部署OVF模板提示用户已取消操作处理方法

    ESXI导出OVF部署到新的ESXI服务器上,Linux主机没有出现用户已取消操作的提示,部署WINDOW虚拟机的时候,提示用户已取消操作,如图: ​首先,要先了解为什么会出现这个问题,原因在于,在做 ...

  4. UIAlertView、 UIActionSheet

    一.UIAlertView. UIActionSheet都是ios系统自带的弹出式对话框,当UIAlertView或UIActionSheet弹出来时用户无法与应用界面中的其它控件交互,UIAlert ...

  5. iOS:简单使用UIAlertVIew和UIActionSheet

    做iOS开发的同学想必都用过UIAlertVIew或者UIActionSheet.UIAlertVIew 可以弹出一个出现在屏幕中间的提示视图,给用户展示信息,并让用户自己选择操作,UIActionS ...

  6. UIAlertView与UIActionSheet

    1.UIAlertView(警告框) 1.1 创建警告框,设置样式 - (IBAction)alertView:(UIButton *)sender {//创建button按钮 //创建警告框的实例 ...

  7. UIAlertController的使用,代替UIAlertView和UIActionSheet

    在iOS8以后,UIAlertView就开始被抛弃了. 取而代之是UIAlertController 以前是警示框这样写: UIAlertView *alert = [[UIAlertView all ...

  8. Appirater -- app中提示用户为app评价的提示框

    Appirater是一段你可以嵌入自己工程中的代码,在用户使用应用一段时间后会自动弹出提示用户进行评分. 使用Appirater方面,你可以简单把源代码嵌入你的app工程中,并把以下代码添加至它的委托 ...

  9. ASP.NET连接数据库时,提示“用户 'sa' 登录失败原因: 未与信任 SQL Server 连接相关联

    用ASP.NET连接数据库时,提示"用户 'sa' 登录失败.原因: 未与信任 SQL Server 连接相关联.".解决方法:首先检查是不是web.config文件内的用户名密码 ...

随机推荐

  1. location url 反向代理到来机的其它端口 gitlab

    location /nexus { proxy_pass http://127.0.0.1:8081/nexus; } [root@GitMaven conf]# pwd /var/opt/gitla ...

  2. Delphi之DLL知识学习3---为什么要使用DLL

    使用DLL有若干理由,其中有一些前面提到过的.大体说来,使用动态链接库可以共享代码.系统资源,可以隐藏实现的代码或底层的系统例程.设计自定义控件 一.共享代码.资源和数据 前面已经提到,共享代码是创建 ...

  3. 攻城狮在路上(叁)Linux(零)--- 软件环境、参考书目等一览表

    1.参考书目:鸟哥的Linux私房菜. 2.环境: Cent_os.

  4. MySQL模糊查询:LIKE模式和REGEXP模式

    MySQL模糊查询提供了两种模式:LIKE模式和REGEXP模式. LIKE模式 LIKE模式是使用的LIKE 或 NOT LIKE 比较运算符进行模糊查询. SELECT 字段 FROM 表 WHE ...

  5. UVA 12901 Refraction 数学

    题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83008#problem/E Description HINT 题意: 给你一个 ...

  6. loj 1316(spfa预处理+状压dp)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=27024 题意:求0-(n-1)的经过最多的标记的点的最短路. 思路 ...

  7. 几种方式实现Javaweb页面跳转

    背景:       自己经手的一个java项目要实现带参页面跳转和页面跳转,完成任务后,总结一下自己知道了的几种方式. 实现: 首先我们有两大种方式来实现页面跳转:1.JS(javascript):2 ...

  8. JavaScript BOM对象介绍

    bom:即broswer object model(浏览器对象模型),由五个对象组成:        Window:对象表示浏览器中打开的窗口 最顶层对象.       Navigator :浏览器对 ...

  9. Eclipse中Ctrl+方法名发现无法进入到该方法中……

    我现在的情况是,按住Ctrl点击该方法后,发现进入不到这个方法的定义. 后来我发现,是因为这个项目是在某个项目文件夹中,如下: 这时直接找到server这个项目就没有问题了,如图:

  10. javascript同名变量

    我写个流程:在流程之前,必须写一下标识符是啥. 一句话,就是variable object的属性.而这个对象会被不同执行环境来决定. 比如全局环境下的variable object 就是 global ...