用這個例子....
// Create Alert
UIAlertView* av = [UIAlertView new];
av.title = @"Find";
// Add Buttons
[av addButtonWithTitle:@"Cancel"];
[av addButtonWithTitle:@"Find & Bring"];
[av addButtonWithTitle:@"Find & Go"];
[av addButtonWithTitle:@"Go to Next"];
// Make Space for Text View
av.message = @"\n";
// Have Alert View create its view heirarchy, set its frame and begin bounce animation
[av show];
// Adjust the frame
CGRect frame = av.frame;
frame.origin.y -= 100.0f;
av.frame = frame;
// Add Text Field
UITextField* text = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
text.borderStyle = UITextBorderStyleRoundedRect;
[av addSubview:text];
[text becomeFirstResponder];
我想你應該檢查你的控制器的自動調整大小:) – 2011-06-13 11:09:27
嘿,你能告訴我你到底要做些什麼。考慮到空間限制,我認爲modalViewController可以在你的情況下更好地工作。請提供更多詳細信息以幫助更好地理解問題。您的問題是textField正在按鈕下方,而您不希望發生這種情況? – SayeedHussain 2011-06-13 11:57:45