UIAlertView不显示完整的消息 [英] UIAlertView not displaying complete message

查看:120
本文介绍了UIAlertView不显示完整的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下功能来向用户显示错误消息。但它似乎没有显示完整的信息。它将显示最多某些字符,然后显示....

I have the following function to display error messages to user. But it does not seem to show the complete message. It will display upto certain characters followed by ....

如何让它显示整个消息?

How can I make it show the entire message?


(void) showAlert:(NSString*)title forMessage:(NSString*) body
{
    UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:body delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alertView show];
    [alertView release];
}


推荐答案

有一种方法。

当您出示提醒时,您可以实施此方法:

When you present your alert, you can just implement this method:

- (void)willPresentAlertView:(UIAlertView *)alertView {
alertView.frame = CGRectMake(alertView.frame.origin.x, alertView.frame.origin.y -50
                             ,alertView.frame.size.width, 300);
}

调整高度以满足您的需要。它看起来像这样:

Adjust the height to fit your need. It will look something like this:

如果你需要移动按钮,你可以添加新行( \ n )到你的消息,它将按下按钮。

If you need to move the button around, you can just add new lines (\n) to your message, and it will move the button down.

这篇关于UIAlertView不显示完整的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆