-[<CALayer: 0x5584190> display]: Ignoring bogus layer size

♀尐吖头ヾ 提交于 2019-12-06 18:17:20

问题


-[<CALayer: 0x5584190> display]: Ignoring bogus layer size (255211754908294243945860531626574872576.000000, 340282346638528859811704183484516925440.000000)

Can any one please tell me whats this warning about? The app is crashing on some devices showing this..

Any suggestion would be greatly helpful.


回答1:


I believe this is caused because the layer is too large and I expect this will cause issues buffering to an image for drawing.

I had this problem with a large UIView with relatively simple graphics and solved it by using a CATiledLayer

To do this, include the following in your UIView subclass to enable tiling:

+ (Class)layerClass {
    return [CATiledLayer class];
}



回答2:


I just encountered this error in a view controller that was being presented in a popover. The "ignoring bogus layer size" error was occurring when the popover was presented, and as a result a text field within the view controller did not render its text.

In my case, moving a textField.becomeFirstResponder() call from viewWillAppear to viewDidAppear resolved the issue.




回答3:


I spent a bit of time trying to find the answer to a similar question, I was getting:

[<CALayer: 0x37d540> display]: Ignoring bogus layer size (nan, nan)

but only on a device, not on the simulator. My problem was due to the fact that I was loading images out of the applicationCacheDirectory and it turns out the files had a mix of upper and lower cases in my project director. But in the Cache directory on device, they were all changed to lower case. Hope this helps someone in the future.




回答4:


I had the same error while working with *UISegmentedControl and I was customizing a text using this method:

[segmentedControl setTitleTextAttributes:(@{UITextAttributeFont: [UIFont regularFontWithSize:13.f],
                                              UITextAttributeTextColor: controlsSelectedColor,
                                              *UITextAttributeTextShadowOffset:* **@0**}) forState:UIControlStateNormal];

The error also occurred only on the device and was because of incorrect attributedText parameter UITextAttributeTextShadowOffset I've set there an NSNumber, but according to documentation it should be UIOffset struct wrapped with NSValue. I've changed it to [NSValue valueWithUIOffset:UIOffsetZero] and it worked. The question is why it didn't work on the Simulator.

So check your attributed text if You've used it. It could be such kind of magic.

Hope this helped.




回答5:


I had this problem with a TableViewController embedded in a nav controller when segueing to detail VC. Changing from a show (push) to show (detail) fixed it. Make sure and clean.




回答6:


I had this problem when using -UIViewShowAlignmentRects YES as a startup variable. When I switched it off, the problem went away. Bug in Xcode?



来源:https://stackoverflow.com/questions/2757334/calayer-0x5584190-display-ignoring-bogus-layer-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!