Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable blinking cursor from UITextField in swift?

How to disable cursor in Swift from UITextField? Condition - When the user logs in, then enter into application. If user can may me logout from application then not show cursor into UITextField.

like image 436
Chandan Jee Avatar asked Sep 15 '16 05:09

Chandan Jee


2 Answers

if you just don't want cursor then you can set it's tintColor to clearColor. In this case your textField will be active. If you want to make it inactive field then you should call resignFirstresponder method of textfield!

like image 145
Ketan Parmar Avatar answered Oct 20 '22 06:10

Ketan Parmar


For Swift 4 that works for me:

textField.tintColor = UIColor.clear
like image 39
GeoSD Avatar answered Oct 20 '22 07:10

GeoSD