11 Jul 2011, 17:09
Generic-user-small

Scott Steinman (4 posts)

I’m trying to create two different types of displays in a program: 1. A static display with text and a stack of papers. The user selects the number of papers. The text may change as the number of papers changes, and the stack of papers must change to reflect the number of papers. The stack of papers is simply an NSImage drawn several times, each overlapping the previous drawn image. 2. A scrolling text display without the papers.

I tried three approaches, and all failed: 1. A CALayer for the text and a CALayer for the pile of papers, so the text CALayer could be reused for the scrolling text. The graphic of the stack of papers and the text did not change as the number of papers was changed. 2. A background NSView for the text and papers, and a CALayer for the scrolling text. With the CALayer present (even if moved offscreen or hidden) the underlying NSView was not visible. The NSView’s drawRect: method was never called, so the graphics and text never appeared, while the scrolling text did. Removing the CAViews made the NSView visible again. 3. The same as 2, but adding the CALayer to the NSView and removing it as needed. This also did not work as the NSView’s drawRect: method was never called.

I’ve thought about using a CALayer for the stack of papers and a CATextLayer for the text, but there’s still the problem of the graphic of the stack of papers not changing.

Any ideas?

15 Jul 2011, 22:40
Generic-user-small

Scott Steinman (4 posts)

Never mind. I decided to split the static and animated displays into two separate VSViews and swap the views out when needed. I was trying to avoid having to do this before, but it seems to be the easiest solution.

  You must be logged in to comment