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 create one-to-zero-or-one relationship programmatically - MySQL?

mysql sql database-design foreign-keys relational-database

I'm busy with a project and one of the stumbling blocks I've come across has been the following:

sitemap not created until server restart in meteor

javascript node.js meteor sitemap

I am using meteor to create simple blog system. For sitemaps files I'm using this package.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.