NSTextView and Core Animation drawing trouble

I'm having some trouble adding CA Layers on top of a NSTextView. I want to be able to add small "bubbles" (like in Xcode) to the text view, so i thought of doing it with core animation. When i enable layer backed mode in the views -awakeFromNib [self wantsLayer:YES], and add a empty CALayer as root layer [self setLayer:rootLayer], the content of the view gets completely destroyed with random garbage

If I set a background color on the root layer, that color shows nicely up. So somehow the textview behind the transparent layer doesnt redraw? Or is it a different problem?

EDIT: Here is an example project producing something similair (at least on 10.8)

Jonas

Answers


It turns out that you can't replace the layer of the NSTextView, but only add sub layers. So replacing the line self.layer = rootLayer with [self.layer addSubLayer:rootLayer] works. Replacing the layer breaks the NSTextView drawing.


Need Your Help

How to get user roles in drupal 7.x?

php drupal drupal-7 drupal-modules

I want to get the user roles Just like getting node types using this

Java Help with Logic in XML SAX Handler

java xml parsing sax handler

I am trying to set up a SAX Handler to parse XML with the following structure:

CAB/SCSF Command vs Events

c# .net cab scsf

What is the difference between the Commands and the Events in CAB? There seem to do the same thing, when is the command intent to be used and the events?