ios - How to hide a blue cursor in a textfield and a keyboard? -


i need empty textfield when viewcontroller appears. tried this:

override func viewwillappear(animated: bool) {     linkfield.placeholder = "test"     linkfield.text = "" } 

but when appears keyboard pops , blue cursor blinks in textfield. how can rid of ?

edit:

i think didn't explain question correctly. don't need empty cursor, need hide , keyboard until user touches textfield input something.

the textfield cursor color based on default tint color. in case it's blue. change tint color clear color.

linkfield.tintcolor = uicolor.clearcolor() 

for edited question, if want dismiss keyboard then

linkfield.resignfirstresponder() 

will dismiss keyboard , when want focus again use

linkfield.becomefirstresponder() 

Comments