您的位置:首页 > 移动开发 > IOS开发

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];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: