Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable touches but not all user interaction on UITextField

I have a UITextField but I want to be in control of when it is focussed and when it is unfocussed.

In order to achieve this I need to be able to block touch events on that text field. I know I could just put a button in front of it and manually do it, but I wanted to know if there was any way to just disable touches on the element.

Many thanks.

like image 699
Thomas Clayson Avatar asked Feb 05 '13 11:02

Thomas Clayson


1 Answers

There does not appear to be a way to block touches with a property of UITextField. I solved this problem by placing a UIView over the text field to block the touches. I set the UIView to "Clear Color" using the attributes inspector. Works great for my application.

like image 85
T.J. Avatar answered Oct 05 '22 23:10

T.J.