在我的应用程序中,我有一个UITextView
. 在该UITextView
用户输入文本时,当用户单击 UIButton(已在工具栏中)时,需要UIButton
在光标当前位置插入一个。我怎样才能得到光标的 X 和 Y 坐标。以编程方式?
我的代码在UIButton 下面(已经在工具栏中)
-(void)inserButton
{
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
myButton.frame = CGRectMake(30, 5, 10, 10);
UIImage *Chkimg = [UIImage imageNamed:@"unchk.png"];
[myButton setBackgroundImage:Chkimg forState:UIControlStateNormal];
[note addSubview:myButton];
}
在这里我需要替换值
myButton.frame = CGRectMake(X, Y, 10, 10);
是否可以获取光标的 X 和 Y 值。?