Isa*_*aac 2 iphone objective-c nsattributedstring core-text
我想创建一个显示标题,子标题,嵌入图像和常规文本(有点类似于维基百科样式页面)的显示.我的标题,子标题,图像和常规文本都是字符串.我理解AttributedString是实现我想要的格式的最佳方式.我无法弄清楚的是如何从我之前存在的字符串创建AttributedString.
displayText = [[NSMutableAttributedString alloc] initWithAttributedString:@"%@ \n %d - %@", self.currentInstance.name, self.currentInstance.number, self.currentInstance.image];
textView.attributedText = displayText;
Run Code Online (Sandbox Code Playgroud)
我是新人,所以我确信这是基本的我做错了.我感谢任何帮助.
尝试
displayText = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",str]];
Run Code Online (Sandbox Code Playgroud)
然后添加你的属性(我可能有拼写错误,因为我在评论框中输入了这个,但这应该有效.
| 归档时间: |
|
| 查看次数: |
4369 次 |
| 最近记录: |