0

我似乎找不到这个,希望它是某个地方的常见问题解答。如何获得在 OS X 上绘制 NSAttributed 字符串所需的最小 NSRect?我正在做一个覆盖无边框的窗口,但我想根据显示字符串所需的大小来限制大小。

4

1 回答 1

1

使用 NSTextContainer 和 NSLayoutManager。更多来自 Apple 的信息: https ://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html

于 2013-05-10T03:39:22.627 回答