我有一个已经运行了几年的程序。突然,当我升级到 iOS 7 时,它不再工作了。我在 UIAlertView 内的 RootViewController 中放置了一个 UIAlertView(密码对话框)。UIAlertView 出现,但其中的 UITextField 没有。关于为什么这突然不起作用的任何线索?
缩写代码:
@implementation RootViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Some initialization
if (!firstTimeInit) {
alert =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Password",
@"Password")
message:NSLocalizedString(@"EnterPassword",
@"EnterPassword")
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
alert.frame = CGRectMake( 0, 0, 300, 260);
UITextField *myTextField =
[[UITextField alloc] initWithFrame:CGRectMake(32.0f, 75.0f,
220.0f, 28.0f)];
myTextField.placeholder = NSLocalizedString(@"Password", @"Password");
[myTextField setSecureTextEntry:YES];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myTextField setBorderStyle:UITextBorderStyleBezel];
myTextField.tag = 11;
[alert addSubview:myTextField];
CGAffineTransform myTransform =
CGAffineTransformMakeTranslation(0.0, 75.0);
[alert setTransform:myTransform];
[prefs retain];
[alert show];
[myTextField becomeFirstResponder];
}
}