如何在UITextView中绘制文本 [英] How to draw text in UITextView

查看:127
本文介绍了如何在UITextView中绘制文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在UITextView中绘制文本,就像在UILabel和UITextField中有一个名为drawTextInRect:的方法一样。我应该在drawRect:或drawLayer:inContext:中实现它。感谢您的关注和耐心!感谢您的关注和耐心!

How to draw text in UITextView just like there is a method called "drawTextInRect:" in UILabel and UITextField. Should I implement it in "drawRect:" or "drawLayer:inContext:". Thank your focus and patient! Thank your focus and patient!

推荐答案

您必须覆盖drawRect。阅读Apple文档中的详细信息。我发现这个简单的示例代码



您必须调用setNeedsDisplay来触发绘图事件。
You must override drawRect. Read details in the Apple documentation. I found this simple example code.

You must call setNeedsDisplay to trigger an drawing event.


这篇关于如何在UITextView中绘制文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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