iOS 6视图层次结构的噩梦 [英] iOS 6 view hierarchy nightmare

查看:109
本文介绍了iOS 6视图层次结构的噩梦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序商店中有一个近五星评级的应用程序,但是当iOS 6出现时,应用程序主视图层次结构中的一些视图开始闪烁。这发生在商店中的应用程序(我在iOS6发布时将其删除)以及模拟器中。

I have an app in the app store with nearly 5-star rating, but when iOS 6 came out, some of the views in in the app's main view hierarchy started blinking. This happens on the app that was in the store (I removed it when iOS6 came out) as well as in the simulator.

我花了大约14个小时,尝试100件事,在Xcode中进行调试,但无法获得任何牵引力。子视图消失并重新出现,就像有一个gremlin随机设置可见属性为每秒最多10次,每次最多10次,在一切都正常的较长时间内。

I've spent about 14 hours, trying 100 things, to debug this in Xcode, but can't get any traction on it. Subviews disappear and reappear like there's a gremlin randomly setting the visible property off and on for each of them up to 10 times per second, in between longer periods where everything is normal.

主界面是用户可以旋转的刻度盘,我在图层上使用3d变换来旋转它。我发现的唯一模式是4个消失的子视图中的3个消失在一起,就像锁定为一个,当表盘旋转到某些离散位置时。

The main interface is a dial that the user can rotate, where I use 3d transforms on a layer to rotate it. The only pattern I've found is that 3 of the 4 disappearing subviews vanish together, as if locked as one, when the dial is rotated to certain discrete positions.

第4个消失的子视图应该是一个静态图像,并且它没有任何可辨别的模式闪烁。

The 4th disappearing subview should be a static image and it's blinking on and off with no discernible pattern.

我喜欢任何想法,关于我如何调试它的提示。它不是内存警告,执行额外的[setNeedsToDisplay]似乎没有效果。我开始认为Apple在iOS6中破坏了一些东西,但我找不到其他人在谈论这些问题。

I'd love any thoughts, tips as to how I can debug this. It's not a memory warning, and executing additional [setNeedsToDisplay] seems to have no effect. I am starting to think Apple broke something in iOS6, but I can't find anyone else talking about these issues.

以下是主视图的子视图和CALayers层次结构的细分:

Here is a breakdown of the main view's hierarchy of subviews and CALayers:


  1. 我的层次结构包含2个基本CALayer,很好。

  2. 上面是一个非常大的自定义UIView(使用drawRect)和一个
    大UIImageVIew,它们一起闪烁,当底部的
    旋转到某个位置时。只有底部的一个是
    旋转。

  3. 上面是一个自动文本绘图UIView,不会闪烁。

  4. 上面那个是一个小的红色图钉UIImageView,与上面的2个视图完全相同,以
    闪烁。这是一个香草
    UIImageView;没有变换或子类或自定义绘图代码!还有
    但它仍然有同样的眨眼。

  5. 上面是一个看不见的UIButton似乎一直都在工作。

  6. 上面这是一个UIImageView,它是一个小的图形,闪烁了
    并且不断地与
    其他3个链接图层的基于旋转的闪烁无关(我说链接因为他们喜欢消失
    all together)。

  1. My hierarchy contains 2 base CALayers that are fine.
  2. Above that are a very large custom UIView (uses drawRect) and a large UIImageVIew that blink off together, always, when the bottom one is rotated to certain positions. Only the bottom one is being rotated.
  3. Above that is a custom text drawing UIView that does not blink off.
  4. Above that is a small red pin graphic UIImageView that blinks off at the exact same time as the above 2 views. This is a vanilla UIImageView; no transforms or subsclass or custom drawing code! And yet it still has the same blinking.
  5. Above that is an invisible UIButton that seems to work all the time.
  6. Above that is a UIImageView that is a small graphic that blinks off and on constantly, unrelated to the rotation-based blinking of the other 3 "linked" layers (I say linked because they like to disappear all together).


推荐答案

尝试手动设置视图图层z-property以确保层次结构是你需要的。

Try manually setting your view layers z-property to ensure the hierarchy is what you need.

这篇关于iOS 6视图层次结构的噩梦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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