Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在UITextView中标记文本,如Facebook标记位置_Objective C_Uitextview_Core Text_Nsattributedstring_Catextlayer - Fatal编程技术网

Objective c 在UITextView中标记文本,如Facebook标记位置

Objective c 在UITextView中标记文本,如Facebook标记位置,objective-c,uitextview,core-text,nsattributedstring,catextlayer,Objective C,Uitextview,Core Text,Nsattributedstring,Catextlayer,我有一个登记屏幕,用户可以在其中添加评论和位置。这与Facebook的状态更新屏幕非常相似 Facebook截图: 我在文本字段中将位置名添加为不可编辑文本时遇到了麻烦(参见facebook屏幕截图中的菱形区域)。我尝试过使用NSMutableAttributedString,但没有效果 使用NSMutableAttributedString帮助我将格式化的attributedString添加到UITextView(并使其看起来像facebook所显示的那样),但我如何确保添加到其中的attri

我有一个登记屏幕,用户可以在其中添加评论和位置。这与Facebook的状态更新屏幕非常相似

Facebook截图:

我在文本字段中将位置名添加为不可编辑文本时遇到了麻烦(参见facebook屏幕截图中的菱形区域)。我尝试过使用NSMutableAttributedString,但没有效果

使用NSMutableAttributedString帮助我将格式化的attributedString添加到UITextView(并使其看起来像facebook所显示的那样),但我如何确保添加到其中的attributedString不可编辑,但可点击(可能再次加载位置)

我的应用程序的屏幕截图:


提前感谢:-)

我通过在textViewDidChangeSelection中将selectedRange设置为所需位置,解决了这个问题: