iOS之UIAlertView的使用
UIAlertView:
1.普通使用:
//普通的alert
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"title" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"ok", nil];
[av show];
2.UIAlertView还可以设置其样式:
如果可以输入账号与密码的样式:
//普通的alert
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"title" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"ok", nil];
[av setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput];//设置样式:明文与暗文
[av show];
3.判断用户点击了alert的哪个按钮的协议:
//协议:alertView
//判断用户点击了alert的那个按钮
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
NSLog(@"you click no");
}
else
{
NSLog(@"you click yes");
}
}
4. 常用方法总结:
- //根据被点击按钮的索引处理点击事件
- -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- {
- NSLog(@"clickButtonAtIndex:%d",buttonIndex);
- }
- //AlertView已经消失时执行的事件
- -(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
- {
- NSLog(@"didDismissWithButtonIndex");
- }
- //ALertView即将消失时的事件
- -(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
- {
- NSLog(@"willDismissWithButtonIndex");
- }
- //AlertView的取消按钮的事件
- -(void)alertViewCancel:(UIAlertView *)alertView
- {
- NSLog(@"alertViewCancel");
- }
- //AlertView已经显示时的事件
- -(void)didPresentAlertView:(UIAlertView *)alertView
- {
- NSLog(@"didPresentAlertView");
- }
- //AlertView即将显示时
- -(void)willPresentAlertView:(UIAlertView *)alertView
- {
- NSLog(@"willPresentAlertView");
- }
iOS之UIAlertView的使用的更多相关文章
- ios之UIAlertView
举例: UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Default Alert View"messa ...
- 【iOS】UIAlertView 点击跳转事件
iOS 开发中,UIAlertView 经常用到.这里记录下曾用到的点击跳转事件. UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@& ...
- iOS - 提示信息 - UIAlertView、UIActionSheet、UIAlertController的实际应用
1.UIAlertView(屏幕中央弹出框)(不需要服从代理) UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@" ...
- IOS开发:UIAlertView使用
链接地址:http://www.2cto.com/kf/201307/231841.html UIAlertView是什么就不介绍了 1.基本用法 1 UIAlertView *view = [[UI ...
- IOS对话框UIAlertView
//修改弹出对话框的样式 alertView.alertViewStyle = UIAlertViewStylePlainTextInput; //根据索引获取指定的某个文本框 [alertView ...
- 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 ...
- iOS改变UIAlertView、UIActionSheet、UIAlertController系统字体颜色
废话不多说,直接上代码,效果是最好的说服力 1.改变UIAlertView字体颜色 [UIView appearance].tintColor = [UIColor greenColor]; 个人还是 ...
- IOS中UIAlertView(警告框)常用方法总结
一.初始化方法 - (instancetype)initWithTitle:(NSString *)title message:(NSString*)message delegate:(id /*&l ...
- IOS UIAlertView(警告框)方法总结
转自:my.oschina.net/u/2340880/blog/408873?p=1 IOS中UIAlertView(警告框)常用方法总结 一.初始化方法 - (instancetype)initW ...
随机推荐
- Form_Form Builder Export导出为Excel(案例)
2014-01-09 Created By BaoXinjian
- c++学习-多态性
强制转换父类对象为子类 #include<iostream> #include<string> #include <typeinfo> using namespac ...
- centos下的一些命令
1.查看版本 cat /etc/redhat-release 2.安装VIM yum -y install vim-enhanced 3.升级系统 yum -y update 4.把 vi 替换为 v ...
- 原始ajax发起请求并反馈
在用户登陆的时候,离开用户.密码输入框即进行验证:ajax发起请求进行验证的: login.jsp代码: <%@ page language="java" contentTy ...
- ORA-30036
http://blog.sina.com.cn/s/blog_676255e101018d5s.html
- expdp impdp终极教学
源地址:http://blog.csdn.net/giianhui/article/details/7788550
- trim
这是一个很常见的函数,他的所用是去掉字符序列左边和右边的空格,如字符串str = " ai lafu yo ";str = trim(str); cout << str ...
- [ActionScript 3.0] AS3 绘制立方体
package { import flash.display.Sprite; import flash.events.Event; import flash.geom.Vector3D; import ...
- ROWID-Oracle中删除重复行数据
DELETE FROM DEPT_BAK WHERE ROWID NOT IN (SELECT MIN(ROWID) RID FROM DEPT_BAK GROUP BY DEPTNO,DNAME,L ...
- photoshop如何选择图层?
选择移动工具,在上边的属性栏里勾选"自动选择图层"功能即可. 只要打上勾, 并且配上是选择图层,还是组, 点到哪里就选中哪里. 参考: http://zhidao.baidu. ...