Linked Questions
53 questions linked to/from Get the current first responder without using a private API
45 votes
4 answers
33k views
Is there any way of asking an iOS view which of its children has first responder status? [duplicate]
In Mac OS X, you can find the first responder like this: [[self window] firstResponder] Is there any way of doing it in iOS? Or do you need to enumerate the child controls and send an ...
1 vote
2 answers
5k views
Determine which control has focus [duplicate]
I am developing an app for iPod/iPhone and I am trying to determine which control has focus. I am new to XCode so my terminology may be incorrect, but I am looking for the object (control) where the ...
1 vote
0 answers
2k views
How to determine which textfield has focus in swift [duplicate]
I have three textfields with 1,2,3 tags respectively. After pressing a button how do I get the textfield which has focus on. For instance, I am tying in textfield tag 1 and then press a button, how ...
352 votes
44 answers
303k views
Move view with keyboard using Swift
I have an app that has a text field on the lower half of the view. This means that when I go to type in the text field the keyboard covers the textfield. How would I go about moving the view upwards ...
286 votes
42 answers
255k views
How to find topmost view controller on iOS
I've run into a couple of cases now where it would be convenient to be able to find the "topmost" view controller (the one responsible for the current view), but haven't found a way to do it. ...
173 votes
25 answers
208k views
Move a view up only when the keyboard covers an input field
I am trying to build an input screen for the iPhone. The screen has a number of input fields. Most of them on the top of the screen, but two fields are at the bottom. When the user tries to edit the ...
105 votes
29 answers
92k views
Dismiss keyboard by touching background of UITableView
I have a UITableView with UITextFields as cells. I would like to dismiss the keyboard when the background of the UITableView is touched. I'm trying to do this by creating a UIButton the size of the ...
92 votes
12 answers
66k views
Class variables not yet supported
I begin my project with a split view controller as initial view controller and start it automatically from storyboard. Generally, an app with this UI have one and only one split view controller as ...
27 votes
18 answers
61k views
How to resign first responder from text field when user tap elsewhere?
I have filled my view with ScrollView (same size as the view) and I'm stuck at how to resign first responder when user tap elsewhere in the View (or the scrollview). Any idea on how to do that ? I'm ...
40 votes
13 answers
52k views
How to make a UIScrollView auto scroll when a UITextField becomes a first responder
I've seen posts around here that suggest that UIScrollViews should automatically scroll if a subview UITextField becomes the first responder; however, I can't figure out how to get this to work. ...
22 votes
7 answers
61k views
Swift: Become First Responder on UITextField Not Working?
I've created a custom UIViewController with one UITextField on Storyboard. On viewDidLoad, I set the UITextFIeld to becomeFirstResponder, nothing happened (no keyboards popped up). I then tried ...
19 votes
6 answers
21k views
Detecting current iPhone input language
Does anybody knows, can I get the current input language and/or keyboard layout in iPhone application? Can I also get a notification when input language was changed?
13 votes
6 answers
17k views
How to get the currently active UITextField/UITextView and resignFirstResponder?
Is it possible to get the currently active UITextField or UITextView in a UIView, so I can hide the keyboard with [text resignFirstResponder];?
19 votes
3 answers
9k views
Walking the responder chain to pass custom events. Is this wrong?
According to the iOS documentation, the responder chain is used to pass touch events "up the chain". It's also used for actions generated by controls. Fine. What I really would like to do is send a ...
9 votes
2 answers
11k views
How to Get Current First Responder from Window Controller in Cocoa?
I would like to find the first responder view in a window. To do this, I would like to implement a category like this: @implementation NSView (ViewExtensions) - (NSView *)findFirstResponder { ...