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

查看:27
本文介绍了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:

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 Engineering 获得答复:

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天全站免登陆