Wednesday 15 June 2011

objective c - Layer hosting NSView within NSOutlineView -


I am trying to create a custom NSView which is the CALayer To perform efficient performance hierarchy, it is embedded within a NSView then a NSTableCellView which is displayed by View-based NSOutlineView .

The problem is that whenever I expand or collapse an item, all the rows are being moved, but the contents of the layer are displayed in that position to change the outline Happens before.

> NSOutlineView seems to be refreshing the layers and they sync again with their rows in that row.

I've debug this behavior from the devices and it seems that scrolling stimulates a layout operation that is a setPosition: call that occurs when the items are being expanded or collapsed was supposed.

Here is some sample code for hosting a <00> code> NSVU subdivision. @ Interface testview: NSVUP @ export @ exploration testview - (Instantize) Intewithframe: (NSRact) fragment {self = [super intwthframe: framereach]; Casplayer * layer = [capsular layer]; Layer.bound = selfbound; Layer.position = CGExMake (NSMIDX (self bands), NSMIDY (self bands)); Layer. Path = [NSBZearpath BeeperPathwith Ovalline Protect: Self Bounds] .CGPath; Layer. Fill collar = [encoker red color]. CG color; Layer. Delegate = self; Self. Layer = layer; Self. Way Layer = Yes; Self return; } @ And

I have tried many possible solutions to this problem, but I could not find any interesting method which is called on NSView example can be overridden to call [self. Layer Setnide Display] or [auto. Layer Setnad's Layout] . I have also tried different setters on CALayer like:

  layer AutoresizingMask = kCALayerWidthSizable | KCALayerHeightSizable; Layer.needsDisplayOnBoundsChange = YES; Self. Layer ContentRadra Policy = NSViewLayerContentsRedrawOnSetNeedsDisplay; Can anyone help me find out how it is a  NSOutlineView  

I ended the answer to my question. The problem was not in the manner of implementing my test-scene. I missed only one step to enable CoreAnimation support within the application. The relevant reference is within the core animation programming guide.

Basically, iOS is always enabled by default in core animation and layer backing. In OS X, it has to be enabled in such a way:

  1. Links against quartzakor framework
  2. Support one or more NSView objects for the following
      < Li> In your Nib files, use the View Impact Inspector to enable layer support for your views. The inspector displays the check box for the selected view and its subview. It is recommended that whenever possible you can support the layer in the country view of your window
    • For ideas created by you programmatically, call the Wentleire set of view: method and To assume that the layers should use the layers.

Once I enable layer support on the parents of any NSOutlineView, different problems are resolved.


No comments:

Post a Comment