【问题标题】:How do I move down the buttons in UIAlertView?如何在 UIAlertView 中下移按钮?
【发布时间】:2012-03-12 02:52:31
【问题描述】:

我在 uialertview 中有三个按钮和一个 textview,并尝试通过在 uialertview 的消息属性中添加“\n”来向下移动按钮。但这是行不通的。当达到一行的限制时,字符串将变为“...”。 textview 总是覆盖我的按钮。你有什么建议吗?抱歉,我无权发布图片。

- (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 )];
}

【问题讨论】:

    标签: ios button message uialertview


    【解决方案1】:

    UIAlert 视图具有最大高度(我尝试过同样的事情但没有成功);你将无法让它变大。我建议您改用自定义弹出窗口。弹出框可以起到警报的作用,但会给您更大的灵活性。

    这个问题有一些教程链接:Are there examples of how to use UIPopoverController on iOS?

    【讨论】:

    • 谢谢,但我确实用 (void)willPresentAlertView 更改了 UIAlertView 的框架。但问题是消息属性中的“\n”不起作用。
    猜你喜欢
    • 1970-01-01
    • 2013-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多