问题
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