Friday 15 April 2011

cocoa - Layer-backed NSView performance with rendering directly in CALayer.drawInContext: -


I have several layer-supported views in a NSScrollview and related primarily Scrolling display documentView and higher levels are supported so their subviews are also layer-backed.

The following are three natural places that can be displayed / rendering code:

  1. Override NSView.wantsUpdateLayer to return false (or something) Do not because it's default) & amp; Drawing of NSView drawRect method
  2. override NSView.wantsUpdateLayer true & amp; Do the drawing in the updateLayer method of NSView
  3. do not make any drawing in NSView & amp; Draw all the illustrations from the WWWDC 2013 session 215 to CALayer's drawInContext method

, it was said that (2 ) More performers (1) Because the scene does not need to create a temporary shop for the output of the drawers. First of all, I do not have 100% clarity when "backing stores" are created and the second does not (2) and (3) compare and when you can use one on another?

Specifically, I have to draw the text in my thoughts How do I do this in the call updating? The only example of dragging a text is to capture a reference - which is not available naturally in the updateLayer .


No comments:

Post a Comment