X $ C $ 6,iOS8上和(空)layoutSubviews [英] Xcode6, iOS8 and (void)layoutSubviews

查看:153
本文介绍了X $ C $ 6,iOS8上和(空)layoutSubviews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有自定义的UILabel这对iOS6的和iOS7正常工作。但在iOS8上这个标签的(空)layoutSubviews方法不会被调用。
我创建这个标签与initWithFrame,因此这种方法应该叫做 - 这就是所谓的另一个IOS版本。
在iOS8上的autoLayout与系统,会发生什么?

I have custom UILabel which works fine on iOS6 and iOS7. But on iOS8 this label's (void)layoutSubviews method never get called. I create this label with initWithFrame, so this method should be called - and it's called on another iOS versions. What happens with autoLayout system in iOS8?

推荐答案

我只想补充这个答案,因为这个问题标题可能导致在这里有很多的脂肪酶的类似问题(像我一样)。

I just want to add this answer because the question title may lead a lot of ppl here with similar issues (like me).

与iOS 8至8.0.2 LayoutSubviews 调用是不可靠的。他们可能不被称为有史以来或(在我的情况)被称为一个循环。

With iOS 8 to 8.0.2 LayoutSubviews calls are unreliable. They may not be called ever or (in my case) are called in a loop.

即使你不应该这样做,这是pretty安全地在LayoutSubviews页头的东西,但这种越野车(?!)的行为就可能导致难以跟踪的错误。

Even though you should not do it, it was pretty safe to alloc stuff in LayoutSubviews, but with this buggy (?!) behaviour it can cause hard-to-trace bugs.

我不知道,如果8.1修复所有问题,但它需要一些时间,直到客户的设备将运行8.1和他们现在运行8.0.2

I don't know if 8.1 fixes all the issues but it will be some time until customer devices will run 8.1 and they do run 8.0.2 NOW

这篇关于X $ C $ 6,iOS8上和(空)layoutSubviews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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