2012-03-12 44 views
0

我在uialertview中有三個按鈕和一個textview,並嘗試在uialertview的消息屬性中添加「\ n」按鈕。但這不起作用。當字符串達到一行的限制時,字符串將變爲「...」。 textview總是覆蓋我的按鈕。你有什麼建議嗎?對不起,我沒有權利發佈圖片。如何向下移動UIAlertView中的按鈕?

- (void)addMessage 
{ 
self.addMessageAlertView = [[UIAlertView alloc] initWithTitle:@"Add Title" 
                 message:@"\n\n\n\n function normal function normal function normal function normal function normal " 
                delegate:self 
              cancelButtonTitle:@"Cancel" 
              otherButtonTitles:@"OK",@"Search", nil]; 
self.addMessageTextView = [[UITextView alloc] initWithFrame:CGRectMake(10.0, 75, 260.0, 25*2)]; 
[addMessageTextView setBackgroundColor:[UIColor whiteColor]]; 
addMessageTextView.font = [UIFont systemFontOfSize:20]; 
addMessageTextView.delegate=self; 
addMessageTextView.layer.masksToBounds=YES; 
addMessageTextView.layer.cornerRadius=10.0; 
addMessageTextView.layer.borderWidth=0.0; 
[addMessageAlertView addSubview:addMessageTextView]; 
[addMessageAlertView show]; 
[addMessageAlertView release]; 
[addMessageTextView release]; 
} 

- (void)willPresentAlertView:(UIAlertView *)openURLAlert 
{ 
[openURLAlert setFrame:CGRectMake(10, 60, 300, 300)]; 
[openURLAlert setBounds:CGRectMake(0, 10, 290, 290)]; 
} 

回答

0

UIAlert查看有最大高度(我試過同樣的事情沒有成功);你將無法做到更大。我建議你改用自定義彈出窗口。一個popover可以像一個警報,但會給你更多的靈活性。

這個問題有一些鏈接教程:Are there examples of how to use UIPopoverController on iOS?

+0

謝謝,但我確實會改變UIAlertView中與(無效)willPresentAlertView框架。但問題是消息屬性中的「\ n」沒有功能。 – MuddySky 2012-03-12 03:53:56