小编Dam*_*llo的帖子

如何向NSAttributedString添加制表位并在UITextView中显示

我正在创建一个iOS应用程序,我想显示一个带有UITextView中指定的特定制表位的属性字符串.我还想在drawRect中使用Core Text将它们直接绘制到UIViews中.我希望(如果可能的话)在两种情况下使用相同的属性字符串.

因此,在我的应用程序中,我创建了一个CFAttributedStringRef或NSAttributedString,并为其应用了一个CTParagraphStyle属性.然后,我尝试在UITextView中显示属性字符串,我得到如下所示的崩溃:

-[__NSCFType headIndent]: unrecognized selector sent to instance 0x7545080

po 0x7545080
$0 = 122966144 CTParagraphStyle:
base writing direction = -1, alignment = 4, line break mode = 0, 
   default tab interval = 0
first line head indent = 0, head indent = 0, tail indent = 0
line height multiple = 0, maximum line height = 0, minimum line height = 0
line spacing adjustment = 0, paragraph spacing = 0, 
   paragraph spacing before = 0
tabs:
( …
Run Code Online (Sandbox Code Playgroud)

iphone nsattributedstring core-text

7
推荐指数
1
解决办法
5842
查看次数

标签 统计

core-text ×1

iphone ×1

nsattributedstring ×1