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 ...
随机推荐
- adb 工具学习
adb (android debug bridge)简单介绍: 1.adb 是 Android SDK中所带工具.使用adb,可以在PC上操作Android设备或者模拟器 2.主要功能有: 将本地ap ...
- JavaScript事件基础知识总结【思维导图】
另外附上来自Nicholas C.Zakas<JavaScript高级程序设计 第3版>中的跨浏览器兼容EventUtil对象. var EventUtil = { //注册事件 addH ...
- 程序进入 EXPORT App_Fault_ISR的原因及措施:
最近再UCOSIII+LPC1768上移植modbus,在定时器初始化部分竟然跑飞进入 EXPORT App_Fault_ISR,查资料.逛论坛.问大牛都没有解决,最后发现竟然是犹豫一个低级失误引起 ...
- ylbtech-dbs-m-QQ邮箱
ylbtech-dbs:ylbtech-dbs-m-QQ邮箱 -- =============================================-- DatabaseName:QQ-Em ...
- Getting started with SciPy for .NET
Getting started with SciPy for .NET 1.) IronPython Download and install IronPython 2.7, this will re ...
- Valid Number @python
Valid Number Validate if a given string is numeric. Some examples:"0" => true" 0.1 ...
- [SQL] 要查询9 月份的数据中的任意时间段,可能是一个月的,也可能是1日到15日的
SELECT * FROM [表名] WHERE datediff(month,[列名],
- poj 1860 Currency Exchange :bellman-ford
点击打开链接 Currency Exchange Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16635 Accept ...
- WPF更新数据源
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windo ...
- BC之The mook jong
Problem Description ZJiaQ want to become a strong man, so he decided to play the mook jong.ZJiaQ wan ...