UIAlertView
2015-11-23 18:45
447 查看
- (IBAction)AlertView:(id)sender {
UIAlertView *alerview=[[UIAlertView alloc]initWithTitle:@"提示" message:@"这是一个警告框" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
// [alerview addButtonWithTitle:@"不确定"];//动态添加子按钮
NSLog(@"%d",alerview.visible);//是否可见
NSLog(@"%d",alerview.numberOfButtons);//警告框的子按钮的个数
NSLog(@"%@",[alerview buttonTitleAtIndex:0]);//指定索引的按钮的标题
/**
* UIAlertViewStyleDefault 基本样式
*UIAlertViewStyleSecureTextInput 带一个密文输入框
*UIAlertViewStylePlainTextInput 带一个明文输入框
*UIAlertViewStyleLoginAndPasswordInput 带有明文+密文样式输入框的警告框
*/
alerview.alertViewStyle=UIAlertViewStyleLoginAndPasswordInput;
UITextField *loginTF=[alerview textFieldAtIndex:0];//获取登陆的输入框
UITextField *password=[alerview textFieldAtIndex:1];//密码的输入框
loginTF.placeholder=@"账号";
password.placeholder=@"密码";
[alerview show];
}
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
//NSLog(@"警示框已经移除");
}
-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
// NSLog(@"警示框将要移除");
}
//根据参数buttonIndex来判断点击事件
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) {
case 0:
{
NSLog(@"取消");
break;
}
case 1:
{
NSLog(@"确定");
break;
}
case 2:
{
NSLog(@"3");
break;
}
case 3:
{
NSLog(@"4");
break;
}
default:
break;
}
}
//按钮组
UIAlertView *alerview=[[UIAlertView alloc]initWithTitle:@"提示" message:@"这是一个警告框" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
// [alerview addButtonWithTitle:@"不确定"];//动态添加子按钮
NSLog(@"%d",alerview.visible);//是否可见
NSLog(@"%d",alerview.numberOfButtons);//警告框的子按钮的个数
NSLog(@"%@",[alerview buttonTitleAtIndex:0]);//指定索引的按钮的标题
/**
* UIAlertViewStyleDefault 基本样式
*UIAlertViewStyleSecureTextInput 带一个密文输入框
*UIAlertViewStylePlainTextInput 带一个明文输入框
*UIAlertViewStyleLoginAndPasswordInput 带有明文+密文样式输入框的警告框
*/
alerview.alertViewStyle=UIAlertViewStyleLoginAndPasswordInput;
UITextField *loginTF=[alerview textFieldAtIndex:0];//获取登陆的输入框
UITextField *password=[alerview textFieldAtIndex:1];//密码的输入框
loginTF.placeholder=@"账号";
password.placeholder=@"密码";
[alerview show];
}
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
//NSLog(@"警示框已经移除");
}
-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
// NSLog(@"警示框将要移除");
}
//根据参数buttonIndex来判断点击事件
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) {
case 0:
{
NSLog(@"取消");
break;
}
case 1:
{
NSLog(@"确定");
break;
}
case 2:
{
NSLog(@"3");
break;
}
case 3:
{
NSLog(@"4");
break;
}
default:
break;
}
}
//按钮组
相关文章推荐
- UINavigationController总结
- easyUI 验证
- UIViewController的生命周期及iOS程序执行顺序
- CYC-关于UIImagePickerController
- Easyui datagrid editor为combobox时指定数据源
- 百度编辑器 多图片批量上传 顺序混乱问题 ueditor
- EasyUI----DataGrid行明细增删改操作
- reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cellIdentifie
- Kibana User Guide [4.2] » Settings » Setting Kibana Server Properties
- [LeetCode] Range Sum Query - Mutable
- iOS-UIImage 互转 UIColor
- 二十六天( UI开始)
- iOS 【UIKit-UIPickerView】
- mrc下自定义UITableViewCell写法
- datagrid参数queryParams--easyUI
- EASYUI datagrid批量修改与提交
- Kibana User Guide [4.2] » Settings » Setting Advanced Options
- hdu5568 sequence2(dp + 高精度)
- UI复习
- [Qt]新增UAC功能之requireAdministrator