简体   繁体   中英

iOS Layer Rendering Queue

I ran into a behavior I don't understand yet. My code basically does this:

  • Create view with some custom UIView content (Views with drawRect), this view has no superview yet, so the Quartz subsytem dosen't call it's [layer display].

  • Then i do a renderInContext of the view.

  • The problem is that sometime the view is rendered perfectly, sometimes it does not render the subviews and it does not call their drawRect.

Why does it happen? I'm missing something. I actually know that the same layer can't be rendered simultaneously. But this view is not rendered on the main thread since it doesn't have a superview.

Thank you much

Well interesting, without seen the source code is almost impossible to understand, but I got few tips that you could use.

  • add the view to a superview setting it's alpha to 0
  • try to add it out of bounds of the superview
  • try to call -setNeedsDiplay on that view

I don't know if they works, rendering system isn't a simple task, but I will give a shot.Ther one thing I didn't get, usually subviews are added as subviews, but you say that you do something with them inside the drawrect. Don't add subviews in drawRect drawRect and addSubview: custom drawing affects which views?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM