我使用帶有三個按鈕的UIAlertView:「關閉」,「提交得分」和@「查看排行榜」。 UIAlertView還包含一個名爲username的UITextField。此時,UITextField「用戶名」覆蓋了UIAlertView中的其中一個按鈕。我只是想知道如何阻止UITextField覆蓋其中一個按鈕,即向下移動按鈕。TextField覆蓋UIAlertView的按鈕
這裏是發生了什麼事的形象:
screenshot http://img684.imageshack.us/img684/3055/screenshot20110108at191.png
這裏是我的代碼:
[username setBackgroundColor:[UIColor whiteColor]];
[username setBorderStyle:UITextBorderStyleRoundRect];
username.backgroundColor = [UIColor clearColor];
username.returnKeyType = UIReturnKeyDone;
username.keyboardAppearance = UIKeyboardAppearanceAlert;
username.placeholder = @"Enter your name here";
username = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
username.borderStyle = UITextBorderStyleRoundedRect;
[username resignFirstResponder];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations"
message:[NSString stringWithFormat:@"You tapped %i times in %i seconds!\n", tapAmount, originalCountdownTime]
delegate:self
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"Submit To High Score Leaderboard", @"View Leaderboard", nil];
alert.tag = 01;
[alert addSubview:username];
[alert show];
[alert release];
謝謝,由於某種原因,仍然沒有解決它? – 2011-01-08 20:38:26
你也改變了CGRectMake嗎?把他們的`origin.y`降低了? – donkim 2011-01-09 02:46:14