简体   繁体   中英

Change cursor position in UITextview

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.

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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM