NSStringDrawingUsesDeviceMetrics标志是什么意思,我们如何使用它? [英] What does the NSStringDrawingUsesDeviceMetrics flag mean and how do we use it?

查看:451
本文介绍了NSStringDrawingUsesDeviceMetrics标志是什么意思,我们如何使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题与我在如何测量Cocoa中文本的可见边界?

这里有几个链接说明了标志的含义。

Apple文档

苹果列表回答一个类似的问题

Here are a couple of links explaining the meaning of the flag.
Apple docs
Apple lists answer to a similar question

从上面的内容,我猜测选项 NSStringDrawingUsesDeviceMetrics 用于获得文本的可见边界,但它似乎不这样做。在输入(字体和字符串)中,我试图给予方法 boundingRectWithSize:options:attributes:没有一个输出是不同的,没有给。

From the above, I guess the option NSStringDrawingUsesDeviceMetrics is given for obtaining the visible bounds of text but it doesn't seem to do that. Among the inputs (font and string) I tried giving to the method boundingRectWithSize:options:attributes: none of the outputs were different when the flag was given compared to when the flag was not given. Am I doing something wrong or is it a bug in Cocoa?

谢谢

推荐答案

Google这个猴子补丁

Google this monkey patch

NS(Attributed)String + Geometrics

NS(Attributed)String+Geometrics

相当可靠。

这篇关于NSStringDrawingUsesDeviceMetrics标志是什么意思,我们如何使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆