这是我在使用此代码时得到的结果:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Rank on ScoreBoard: %d",positionOnBoard] message:@"" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"Submit", nil];
nameField = [[UITextField alloc] initWithFrame:CGRectMake(12, 25, 260, 21)];
[nameField setBackgroundColor:[UIColor whiteColor]];
[nameField setPlaceholder:@"Your Name Here!"];
[alert addSubview:nameField];
[alert show];
[nameField becomeFirstResponder];
[alert release];
如你所见,它搞砸了。 它只发生在将我的项目升级到iOS 4.0时。
答案 0 :(得分:0)
最终我通过在InitWIthTitle参数中添加“\ n”(YES,它是\ n后面的空格)来增加UIAlertView的高度来解决它,然后我有足够的空间来正确放置UITextField。