Custom UIView with UITextField, textfield does not become first responder upon tap

1,085 views
Skip to first unread message

Ashraf

unread,
Aug 17, 2013, 11:49:56 PM8/17/13
to iphonesdkd...@googlegroups.com
Hey Everyone,
I am trying to subclass a UIView with with some other controls, when I add a UITextField to the view and try to tap it, the textfield does not become first responder, when i force through the code as [textfield becomeFirstResponder]; it does. But i want it to become first responder upon tap itself like it does. the subclass to UIView and adding textfield everything done through the code only.
Please help me out.

Thanks,
Ashraf Hussain

Jesse Tayler

unread,
Aug 18, 2013, 10:28:42 AM8/18/13
to iphonesdkd...@googlegroups.com

is your textField view below another view?

and of course, your view is not a scroll view which takes the tap for itself and you’d have to pass it down.

otherwise, if the textField is on top, you should be able to tap and it should become first responder…

so, that’s a little confusing.

--
You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iphonesdkdevelop...@googlegroups.com.
To post to this group, send email to iphonesdkd...@googlegroups.com.
Visit this group at http://groups.google.com/group/iphonesdkdevelopment.
For more options, visit https://groups.google.com/groups/opt_out.

Ashraf Hussain

unread,
Aug 18, 2013, 11:20:36 AM8/18/13
to iphonesdkd...@googlegroups.com, iphonesdkd...@googlegroups.com
It's a top view over a UIView only. Still the tap isn't making it the first responder.

Sent from my iPhone

ROHIT

unread,
Aug 18, 2013, 12:25:06 PM8/18/13
to iphonesdkd...@googlegroups.com
try setting isUserInteractionEnabled value to true for both your UIView and textfield.

Regards,
Rohit Arora

Ashraf Hussain

unread,
Aug 18, 2013, 12:27:22 PM8/18/13
to iphonesdkd...@googlegroups.com, iphonesdkd...@googlegroups.com
Already did that but not working. Is that kinda bug?

Sent from my iPhone

ROHIT

unread,
Aug 18, 2013, 11:26:20 PM8/18/13
to iphonesdkd...@googlegroups.com
No its not a bug whenver we add atextfield we add it on a uiview. Most probabky iys a wrong frame being given have you tried giving background colour to ur uiview and textfield and check if they have correct frames.

Ashraf Hussain

unread,
Aug 18, 2013, 11:32:50 PM8/18/13
to iphonesdkd...@googlegroups.com, iphonesdkd...@googlegroups.com
Done that as well, its place correctly on the view.

Sent from my iPhone

Jesse Tayler

unread,
Aug 19, 2013, 8:20:08 AM8/19/13
to iphonesdkd...@googlegroups.com

don’t subclass UIView BTW, there’s not going to be any need for that and it might be related to your lost tap.

have you used a regular UIView or xib and simply dropped a textfield onto a view?

Trần Ngọc Hưng

unread,
Nov 19, 2014, 2:54:12 PM11/19/14
to iphonesdkd...@googlegroups.com
I have same problem. Have you fix this error? Thanks!

ajay

unread,
Nov 19, 2014, 10:37:20 PM11/19/14
to iphonesdkd...@googlegroups.com
I done same approach but didn't face mentioned  issue, If you provide sample I am happy to dig into the problem.  

--
You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iphonesdkdevelop...@googlegroups.com.
To post to this group, send email to iphonesdkd...@googlegroups.com.
Visit this group at http://groups.google.com/group/iphonesdkdevelopment.
For more options, visit https://groups.google.com/d/optout.



--

-by
ajay kumar
IOS developer
+91-8056159532

Nguyễn Thành Hưng

unread,
Nov 19, 2014, 10:52:59 PM11/19/14
to iphonesdkd...@googlegroups.com
Hi

Can you show your code?
--
You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iphonesdkdevelop...@googlegroups.com.
To post to this group, send email to iphonesdkd...@googlegroups.com.
Visit this group at http://groups.google.com/group/iphonesdkdevelopment.
For more options, visit https://groups.google.com/d/optout.


--
Nguyen Thanh Hung (Mr)

iOS Developer

Mobile: (84) 1 647 199 339


Reply all
Reply to author
Forward
0 new messages