开发者

Scaled preview: use NSTextView, NSTextField, CATextLayer, or drawInRect?

开发者 https://www.devze.com 2023-04-05 08:45 出处:网络
I\'m programming a cocoa app that presents text (vertically and horizontally) centered on a projector screen.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号