我正在實現一個簡單的對話框,要求輸入名稱。這是我的代碼:UITextField在輸入對話框中不顯示
UIAlertView* dialog = [[UIAlertView alloc] init];
[dialog setDelegate:self];
[dialog setTitle:@"Enter Name"];
[dialog setMessage:@" "];
[dialog addButtonWithTitle:@"Cancel"];
[dialog addButtonWithTitle:@"OK"];
UITextField *nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
[nameField setBackgroundColor:[UIColor whiteColor]];
[dialog addSubview:nameField];
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 20.0);
[dialog setTransform: moveUp];
[dialog show];
[dialog release];
[nameField release];
它曾經工作正常,但在iOS 7的文本框不顯示。誰能幫忙?
三江源,是偉大工程 – Booms