ios警告框中加入其它控件的方法
2015-07-06 08:50
483 查看
一下示例展示了UIAlertView中加入输入框的方法:
-(void)showAlterDlg{
UIAlertView *passwordAlert = [[UIAlertView alloc] initWithTitle:@”请输入你的手机号”
message:@”系统会发送初始密码短信\n\n\n”
delegate:self
cancelButtonTitle:@”取消”
otherButtonTitles:@”确定”, nil];
UITextField *passwordField = [[UITextField alloc] initWithFrame:CGRectMake(12,80,260,30)];
passwordField.borderStyle = UITextBorderStyleBezel;
passwordField.placeholder = @”手机号码”;
passwordField.backgroundColor = [UIColor whiteColor];
passwordField.keyboardType = UIKeyboardTypeNumberPad;
passwordField.tag = 106;
[passwordField becomeFirstResponder];
[passwordAlert addSubview:passwordField];
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
if ([[systemVersion substringToIndex:1] intValue]<4) {
[passwordAlert setTransform:CGAffineTransformMakeTranslation(0,108)];
}
[passwordAlert show];
[passwordAlert release];
[passwordField release];
}
-(void)showAlterDlg{
UIAlertView *passwordAlert = [[UIAlertView alloc] initWithTitle:@”请输入你的手机号”
message:@”系统会发送初始密码短信\n\n\n”
delegate:self
cancelButtonTitle:@”取消”
otherButtonTitles:@”确定”, nil];
UITextField *passwordField = [[UITextField alloc] initWithFrame:CGRectMake(12,80,260,30)];
passwordField.borderStyle = UITextBorderStyleBezel;
passwordField.placeholder = @”手机号码”;
passwordField.backgroundColor = [UIColor whiteColor];
passwordField.keyboardType = UIKeyboardTypeNumberPad;
passwordField.tag = 106;
[passwordField becomeFirstResponder];
[passwordAlert addSubview:passwordField];
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
if ([[systemVersion substringToIndex:1] intValue]<4) {
[passwordAlert setTransform:CGAffineTransformMakeTranslation(0,108)];
}
[passwordAlert show];
[passwordAlert release];
[passwordField release];
}
相关文章推荐
- iOS开发笔记—— 获取音频的专辑图与视频的缩略图
- 关于OC的内存管理-01
- IOS OC objc_msgSend的作用
- IOS OC 消息转发机制
- iOS 中json解析数据出现中文乱码的问题
- (8/18)重学Standford_iOS7开发_协议、block、动画_课程笔记
- IOS菜鸟的所感所思(十六)—— 立体式的切换视图
- IOS Vuforia SDK学习笔记
- IOS 退出程序时存储数据
- IOS-懒加载
- iOS键盘的简单处理
- iOS CocoaPods集成简介
- iOS阶段学习第15天笔记(NSDate操作)
- ios- 跳转到系统界面
- iOS关于CGContextSetBlendMode: invalid context 0x0的错误
- ios项目(八)
- iOS开发过程中的内存监控
- iOS阶段学习第15天笔记(NSDictionary与NSMutableDictionary 字典)
- iOS添加图片
- iOS阶段学习第15天笔记(NSArray与NSMutableArray 数组)