Scaled preview: use NSTextView, NSTextField, CATextLayer, or drawInRect?
I'm programming a cocoa app that presents text (vertically and horizontally) centered on a projector screen.
I'd like to have a small preview of what I see on the "wall" in a cocoa window on the computer's screen (in a NSCollectionView
). Just like "presenter mode" in Powerpoint where you see the current and the next slide as previews.
Which way do you recommend for implementing the presented text?
NSTextField
turned out to be tricky for aligning and scaling the text. CATextLayer
, on the other hand, feels a little bit overkill for such a simple task, even though the scaling works like a charm. Would using NSTextView
or drawInRect
be a good trade-off?
I appreciate your assistance in making sure that I didn't miss something out before I spend hours and days on this :) My goals are to keep it robust and simpl开发者_JAVA百科e. Thanks!
CATextLayer
is definitely not overkill. In fact, a CATextLayer
is considerably more lightweight than an NSView
and would seem ideal for your situation.
精彩评论