我有以下功能可以向用户显示错误消息。但它似乎没有显示完整的消息。它将显示最多某些字符,后跟 ....
我怎样才能让它显示整个消息?
(void) showAlert:(NSString*)title forMessage:(NSString*) body
{
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:body delegate:self cancelButtonTitle:@"OK"otherButtonTitles:nil];
[警报 View 显示];
[警报 View 发布];
}
最佳答案
有一种方法。
当你展示你的警报时,你可以实现这个方法:
- (void)willPresentAlertView:(UIAlertView *)alertView {
alertView.frame = CGRectMake(alertView.frame.origin.x, alertView.frame.origin.y -50
,alertView.frame.size.width, 300);
}
调整高度以满足您的需要。它看起来像这样:
如果您需要移动按钮,您只需在消息中添加新行(
\n
),它就会将按钮向下移动。关于iphone - UIAlertView 未显示完整消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4548387/