Mur*_*ock 7 cocoa-touch uitextview nsattributedstring ios
我通过属性字符串属性在故事板中设置UITextView文本的外观.但是,当我尝试在运行时访问它以复制属性对象时,它返回null.
NSAttributedString *atrString = self.contentTextView.attributedText;
NSLog(@"atrString = %@", atrString);
Run Code Online (Sandbox Code Playgroud)
输出
2013-09-20 14:44:19.572 PageTest[69125:70b] atrString = (null)
Run Code Online (Sandbox Code Playgroud)
我之前没有使用过属性字符串所以我确定我做错了什么,但是搜索文档仍然让我空洞.任何援助将不胜感激.谢谢!
小智 0
它应该有效。可能您忘记将 IBOutlet contentTextView 连接到情节提要?
尝试打印 contentTextView 对象:
NSLog(@"contentTextView = %@", self.contentTextView);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
793 次 |
| 最近记录: |