Xcode6, iOS8 and (void)layoutSubviews(Xcode6、iOS8 和 (void)layoutSubviews)
问题描述
我有自定义的 UILabel,它在 iOS6 和 iOS7 上运行良好.但是在 iOS8 上,这个标签的 (void)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.
即使您不应该这样做,在 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
这篇关于Xcode6、iOS8 和 (void)layoutSubviews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Xcode6、iOS8 和 (void)layoutSubviews
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
