UITextField show cursor even when userInteractionEnabled is set to NO

别说谁变了你拦得住时间么 提交于 2019-12-02 05:41:48

You can add a small UIView with a repeting animation that sets the alpha to 0 and 1 back and forth with animateWithDuration:delay:options:animations:completion:.

[UIView animateWithDuration:1 
                      delay:0 
                    options:UIViewAnimationOptionRepeat 
                 animations:^{ [cursorView setAlpha:0]; }
                 completion:^(BOOL animated){ [cursorView setAlpha:1]; } ];

To position the view correctly as a subview of the textfield, in front of the text entered, you can use the NSString method sizewithfont:forWidth:lineBreakMode:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!