更改UITextview中的光标位置 [英] Change cursor position in UITextview
本文介绍了更改UITextview中的光标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用 addSubview
方法在 UITextView
中添加了 UIImageView
.现在,我想更改光标位置,以便它开始在 UIImageview
位置之后输入任何字符串.
I have added UIImageView
in UITextView
using the addSubview
method. Now I want to change the cursor position so that it starts entering any string after the UIImageview
position.
推荐答案
我对自定义UITextField也做了同样的操作.
I did the same for my Custom UITextField.
cursor=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cursor.png"]];
CGFloat width = [myTextFied.text sizeWithFont:myTextFied.font].width;
cursor.frame=CGRectMake(width+1, 7, 2, 20);
[myTextFied addSubview:cursor];
这篇关于更改UITextview中的光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文