UIAlertView 与 UIActionSheet (提示用户)的使用方法
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 (提示用户)的使用方法的更多相关文章
- 关于微信小程序发布新版本后的提示用户更新的方法详解
当小程序发布新的版本后 ,用户如果之前访问过该小程序,通过已打开的小程序进入(未手动删除),则会检测新版本,提醒用户更新新的版本 话不多说,上代码 App({ onLaunch: function ( ...
- 写给大忙人的centos下ftp服务器搭建(以及启动失败/XFTP客户端一直提示“用户身份验证失败”解决方法)
注:个人对偏向于底层基本上拿来就用的应用,倾向于使用安装包,直接yum或者rpm安装:而对于应用层面控制较多或者需要大范围维护的,倾向于直接使用tar.gz版本. 对于linux下的ftp服务器,实际 ...
- ESXI部署OVF模板提示用户已取消操作处理方法
ESXI导出OVF部署到新的ESXI服务器上,Linux主机没有出现用户已取消操作的提示,部署WINDOW虚拟机的时候,提示用户已取消操作,如图: 首先,要先了解为什么会出现这个问题,原因在于,在做 ...
- UIAlertView、 UIActionSheet
一.UIAlertView. UIActionSheet都是ios系统自带的弹出式对话框,当UIAlertView或UIActionSheet弹出来时用户无法与应用界面中的其它控件交互,UIAlert ...
- iOS:简单使用UIAlertVIew和UIActionSheet
做iOS开发的同学想必都用过UIAlertVIew或者UIActionSheet.UIAlertVIew 可以弹出一个出现在屏幕中间的提示视图,给用户展示信息,并让用户自己选择操作,UIActionS ...
- UIAlertView与UIActionSheet
1.UIAlertView(警告框) 1.1 创建警告框,设置样式 - (IBAction)alertView:(UIButton *)sender {//创建button按钮 //创建警告框的实例 ...
- UIAlertController的使用,代替UIAlertView和UIActionSheet
在iOS8以后,UIAlertView就开始被抛弃了. 取而代之是UIAlertController 以前是警示框这样写: UIAlertView *alert = [[UIAlertView all ...
- Appirater -- app中提示用户为app评价的提示框
Appirater是一段你可以嵌入自己工程中的代码,在用户使用应用一段时间后会自动弹出提示用户进行评分. 使用Appirater方面,你可以简单把源代码嵌入你的app工程中,并把以下代码添加至它的委托 ...
- ASP.NET连接数据库时,提示“用户 'sa' 登录失败原因: 未与信任 SQL Server 连接相关联
用ASP.NET连接数据库时,提示"用户 'sa' 登录失败.原因: 未与信任 SQL Server 连接相关联.".解决方法:首先检查是不是web.config文件内的用户名密码 ...
随机推荐
- Bootstrap – 1.认识
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- Mybatis 字符绑定
http://blog.csdn.net/softwarehe/article/details/8889206
- Python 调试 PDB
出处:http://blog.163.com/gjx0619@126/blog/static/12740839320114995947700/ 完整 请参考:http://docs.python.or ...
- float 的有效数字为七位是怎么得出来的
以下内容来自CSDN网友xian_wwq的回答(http://bbs.csdn.net/topics/390874239): float: 1bit(符号位) 8bits(指数位) 23bits( ...
- 攻城狮在路上(肆)How tomcat works(三) 连接器:Connector
在介绍中提到,Catalina中有两个主要的模块:连接器和容器.本章中你将会写一个可以创建更好的请求和响应对象的连接器,用来改进第2章中的程序.一个符合Servlet 2.3和2.4规范的连接器必须 ...
- MS SQL 合并结果集并求和 分类: SQL Server 数据库 2015-02-13 10:59 92人阅读 评论(0) 收藏
业务情景:有这样一张表:其中Id列为表主键,Name为用户名,State为记录的状态值,Note为状态的说明,方便阅读. 需求描述:需要查询出这样的结果:某个人某种状态的记录数,如:张三,待审核记录数 ...
- JavaScript高级程序设计 读书笔记
第一章 JavaScript 简介 第二章 Html中使用JavaScript 第三章 基本概念 第四章 变量,作用域,内存 第五章 引用类型 第六章 面向对象 第七章 函数表达式 第八章 BOM 第 ...
- AgileEAS.NET SOA 中间件平台 5.2 发布说明-包含Silverlight及报表系统的开源代码下载
一.AgileEAS.NET SOA 中间件简介 AgileEAS.NET SOA 中间件平台是一款基于基于敏捷并行开发思想和Microsoft .Net构件(组件)开发技术而构建的一个快速 ...
- 将数据导出成excel表
/// <summary> /// 生成excel表 /// </summary> /// <param name="dt">数据表</p ...
- PMP 第七章 项目成本管理
估算成本 制定预算 控制成本 1.成本管理计划的内容和目的是什么? 包括对成本进行估算 预算和控制的各过程,从而确保项目在批准的预算内完工. 2.直接成本.间接成本.可变成本.固定成本.质量成 ...