CTFrameGetVisibleStringRange Incorrectly Counting Spaces at End of String?

痴心易碎 提交于 2019-12-25 00:30:07

问题


I'm working with CoreText and I notice that CTFrameGetVisibleStringRange incorrectly counts spaces at the end of the string which are NOT visible in the frame as being visible. FYI, I am adding the space as a string @" " using insertAttributedString to the end of my NSMutableAttributedString. Does anyone know how to fix this?

UPDATE: Still haven't found a solution to this, is this the intended behavior? Or this just a bug?


回答1:


This is a bug. To work around this replace the " " at the end of the string with something else, do whatever you need to do, then reinsert the " " at the end.



来源:https://stackoverflow.com/questions/11061090/ctframegetvisiblestringrange-incorrectly-counting-spaces-at-end-of-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!