2011-06-13 38 views
0

我自定義UIAlertView並添加UITextViewUITextfield,但我需要設置按鈕(我在標準init中添加按鈕)到UIAlertView視圖的底部。雖然initUIAlertView我添加消息:@"\n\n\n\n\n"這給我5個字符串,但是當我添加另一個UIAlertView顯示它的標準textview。 看看形象,使其更清楚地瞭解我有什麼,我需要什麼。 enter image description hereUIAlertView自定義,如何管理標準按鈕?

+0

我想你應該檢查你的控制器的自動調整大小:) – 2011-06-13 11:09:27

+0

嘿,你能告訴我你到底要做些什麼。考慮到空間限制,我認爲modalViewController可以在你的情況下更好地工作。請提供更多詳細信息以幫助更好地理解問題。您的問題是textField正在按鈕下方,而您不希望發生這種情況? – SayeedHussain 2011-06-13 11:57:45

回答

0

用這個例子....

// 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]; 
相關問題