Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios CATextLayer/NSAttributedString-确定显示文本的确切大小_Ios_Objective C_Nsattributedstring_Core Text_Catextlayer - Fatal编程技术网

Ios CATextLayer/NSAttributedString-确定显示文本的确切大小

Ios CATextLayer/NSAttributedString-确定显示文本的确切大小,ios,objective-c,nsattributedstring,core-text,catextlayer,Ios,Objective C,Nsattributedstring,Core Text,Catextlayer,我有一个CATextLayer和一个NSAttributedString,我想计算可见/绘制文本的确切大小 我试过这个: 但是它对字符串“1”和“5”给出了相同的结果,即使使用我的测试字体(AvenirNextCondensed),这两个字体的宽度显然不一样 如何计算可见文本的确切大小?您是否试图在路径上考虑文本的紧排,类似于以下内容:

我有一个CATextLayer和一个NSAttributedString,我想计算可见/绘制文本的确切大小

我试过这个:

但是它对字符串“1”和“5”给出了相同的结果,即使使用我的测试字体(AvenirNextCondensed),这两个字体的宽度显然不一样


如何计算可见文本的确切大小?

您是否试图在路径上考虑文本的紧排,类似于以下内容: