UILabel 文本可见部分
有没有办法获得文字的可见部分UILabel
?我的意思是最后一个可见字符?
我想在图像周围制作两个标签,并希望在第二个标签上继续第一个标签超出矩形的文本。
我知道 [NSString sizeWithFont...]
但是否有类似 [NSString stringVisibleInRect: withFont:...]
的反转? :-)
先感谢您。
Is there a way to get the visible part of text in word wrapped UILabel
? I mean exactly the last visible character?
I'd like to make two labels rounding the image and would like to continue the text which was out of rect for first label on the second one.
I know [NSString sizeWithFont...]
but are there something reversing like [NSString stringVisibleInRect: withFont:...]
? :-)
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用类别来扩展 NSString 并创建您提到的方法
You could use a category to extend NSString and create the method you mention
这是使用 iOS 7 API 的 O(log n) 方法。仅进行了初步测试,如果发现任何错误,请评论。
Here's a O(log n) method with iOS 7 APIs. Only superficially tested, please comment if you find any bugs.