IOS7下,alertView不能使用addSubview添加textField解决办法
UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:@"Enter Form Name" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil]; alertView1.alertViewStyle = UIAlertViewStyleSecureTextInput; UITextField *myTextField = [alertView1 textFieldAtIndex:0]; [alertView1 setTag:555]; myTextField.keyboardType=UIKeyboardTypeAlphabet; [alertView1 show];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(180, 10, 85, 50)]; UIImage *wonImage = [UIImage imageNamed:@"image.png"]; [imageView setImage:wonImage]; //check if os version is 7 or above if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { [alertView setValue:imageView forKey:@"accessoryView"]; }else{ [alertView addSubview:imageView]; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。