Ios7 如何更改UITextView的光标样式?

Ios7 如何更改UITextView的光标样式?,ios7,cursor,uitextfield,uitextview,Ios7,Cursor,Uitextfield,Uitextview,在UITextView中编辑时,我知道如何通过设置tintColor来更改光标颜色。 为什么要将光标更改为其他样式 例如:固定宽度的闪烁框。或者一个下划线““我找到了一个解决方案: 1.子类化UITextView 2.覆盖caretRectForPosition:方法 - (CGRect)caretRectForPosition:(UITextPosition *)position { CGRect myRect = [super caretRectForPosition:positio

在UITextView中编辑时,我知道如何通过设置tintColor来更改光标颜色。 为什么要将光标更改为其他样式

例如:固定宽度的闪烁框。或者一个下划线““

我找到了一个解决方案:

1.子类化UITextView

2.覆盖caretRectForPosition:方法

- (CGRect)caretRectForPosition:(UITextPosition *)position
{
    CGRect myRect = [super caretRectForPosition:position];
    myRect.size.width = 5; // Modify the width of the caret
    myRect.size.height = 5; // Modify the height of the caret

    return myRect;
}