UIAlertView自动换行在iOS8中消失了吗? [英] UIAlertView automatic newline gone in iOS8?

查看:120
本文介绍了UIAlertView自动换行在iOS8中消失了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UIAlertView似乎与iOS8不兼容。我刚刚发现我的所有多行UIAlertViews都成了iOS8中的截断单行(用于消息)。在iOS7中,它们使用多行显示正确。

It appears that UIAlertView is not compatible with iOS8. I've just discovered that all my multiline UIAlertViews become truncated one-liners in iOS8 (for the message). In iOS7 they are displayed correctly with multilines.

iOS7:

iOS7:

iOS8:

iOS8:

[[[UIAlertView alloc] initWithTitle:@"Namn saknas"
                            message:@"Du måste fylla i ditt namn för att kommentera"
                           delegate:nil
                  cancelButtonTitle:@"OK"
                  otherButtonTitles: nil] show];

我知道UIAlertController应该在iOS8及更高版本中使用,并且UIAlertView已被弃用iOS8上。

I'm aware of that UIAlertController should be used in iOS8 and later and that UIAlertView is deprecated as of iOS8.

但是在iOS8中不应该像以前一样(即iOS7)吗?如果没有,不应该从iOS7中弃用它吗?

BUT shouldn't still work as previously (i.e iOS7) in iOS8? If not, shouldn't it have been deprecated from iOS7?

或者我在这里遗漏了什么?这些不仅仅是一个关于事情应该如何的伪问题 - 我在代码中有超过40个地方有警报视图,现在不在时间表中更改所有这些......

Or I'm I missing something here? These is not just a pseudo issue over how things should be - I have over 40 places in the code with alert views and it's not in the timetable to change all these now...

推荐答案

此问题现已解决 - Apple Apple获得答案:

This issue is now resolved - got an answer from Apple Engineering:

您的示例项目在UILabel上声明了一个类别覆盖-intrinsicContentSize。覆盖UIKit方法会导致不可预测的行为。

"Your sample project declares a category on UILabel which overrides -intrinsicContentSize. Overriding UIKit methods leads to unpredictable behavior."

所以我删除了覆盖,一切正常。

So I removed the override and everything worked fine.

覆盖是:

-(CGSize)intrinsicContentSize {
    CGSize s = [super intrinsicContentSize];
    s = CGSizeMake(s.width, s.height + 4);
    return s;
}

这篇关于UIAlertView自动换行在iOS8中消失了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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