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 { ...
9 votes
4 answers
4k views
Is it possible to get textfield assosiated with a keyboard?
In my view controller I'm subscribed to UIKeyboardWillShowNotification: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(...
8 votes
3 answers
8k views
Deleting cells from UICollectionView via NSNotification
I have a simple UICollectionView based app - one UICollectionView and a NSMutableArray based data model for simplicity. I can delete cells with no problem via the didSelectItemAtIndexPath: delegate ...
6 votes
5 answers
9k views
How to identify which textfield is currently first responder
If you have several text fields on the screen, and the keyboard pops up for each one when they are tapped, what if you want to programmatically hide the keyboard, or resign first responder, but you ...
8 votes
4 answers
3k views
removing keyboard from Screen without calling resignFirstResponder
I have a custom View (NotifyView) added on UIWindow with a dismiss button(which remove it from UIWindow). This view is added when a PUSH notification comes in didReceiveRemoteNotification there are ...
7 votes
3 answers
3k views
Hiding the UIKeyboard
I am trying to hide the keyboard in my SplitView application (because it covers over part of the root menu). However, the only thing I can find is how to hide the keyboard after a textfield has been ...
4 votes
8 answers
5k views
Dismissing the keyboard for a UITextField in UIAlertView
I have a Customized UIAlertView.I have a UITextField in that AlertView, which becomes the firstResponder as soon as it is shown. Now I need to dismiss the keyboard for that UITextField when user ...
3 votes
1 answer
2k views
An utility method for hiding the keyboard
In my project I have several pages with many UITextField-s. So I figured it would be better to create an utility method named hideKeyboard which would work in any case. Here is my solution, but ...
6 votes
2 answers
4k views
How to get UITextField from inputAccessoryView button click
I have a dynamic number of UITextFields which all have an inputAccessoryView. This is composed of a UIToolbar which has a button on it. When this button is pressed it calls a method, however, within ...
9 votes
2 answers
5k views
How do I enable spell checking within an NSTextField on Mac OS X?
I have an NSTextField that I would like to enable "as-you-type" spell checking. When I load my application I can do this from the Menu Bar > Edit > Spelling and Grammar > Check Spelling While Typing. ...
4 votes
4 answers
4k views
UITableViewCell and resignFirstResponder
I have a UITableView containing in each cell a UITextField. When the user clicks on the UITextField, as expected, the keyboard will popup. I have implemented in my delegate tableView: ...
2 votes
4 answers
9k views
Make UIView resign first responder when tapped outside of view
Is there any way to make a UIView resign its first responder status when the user taps outside of the view bounds?
1 vote
2 answers
1k views
Dismissing keyboard on iPad from textfield inside tableviewcell
I have a problem with the iOS keyboard. I have a UITextField inside a UITableViewCell. When tapping on another TableViewCell within the same TableView, I want to dismiss the keyboard before showing a ...
9 votes
2 answers
1k views
UITextField losing firstResponder after view appears
I have a UIPageViewController. One page has a single button, and the other page has a UITextField with a button. When the page scrolls to the view with the field, I'd like it to becomeFirstResponder ...
12 votes
1 answer
3k views
textFieldShouldBeginEditing called multiple times when "Tab" key is pressed
I have a form screen with multiple input fields that are contained inside UITableView. If a user connects bluetooth keyboard then he is able to press "Tab" key. The problem with that is ...
7 votes
2 answers
2k views
How to present UIAlertController action sheet while keyboard is active?
I present UIAlertController action sheet from my UIViewController: UIAlertController sheet = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:...
0 votes
3 answers
3k views
textViewDidBeginEditing - determining which text box is being edited
I have a page with 5 UITextView objects. I use the textViewDidBeginEditing: method to animate the observationComment text box which works fine. But now I want to do the same for the other 4, but I can'...
2 votes
1 answer
2k views
How to know who isFirstResponder?
Very beginner obj-c question. Is it a possibility to ask about who is first responder at the moment? I have a tableView with four custom cells and with textfield in every cell. Link I tagged ...
1 vote
1 answer
3k views
UITextField to resign first responder on UIButton touch
I have a UITableView with some cells containing UITextField objects and others with UIButton objects. When one of the textFields is first responder (keyboard showing) i am having trouble resigning its ...
2 votes
2 answers
1k views
tableView frame.origin problem after textField resignFirstResponder in custom tableViewCell
I'm using an tableView with custom cells. When I want to display another view using the pushViewController function of the navigationController I loop through the textfields and call ...
3 votes
1 answer
1k views
iOS - how to dismiss keyboard?
In my app, I press a button and it pulls up a modal presentation sheet (for iPad). Within this modal view I have a scrollview within my main view, and 1 text field within my scroll view. view ...
2 votes
1 answer
2k views
UIWebview [UIThreadSafeNode _responderForEditing] crash
So I have a app that is webview based. I have made some keyboard modifications (not the issue, removed them all for troubleshooting). On the iPhone 6+ simulator, when in landscape mode, if something ...
1 vote
1 answer
972 views
Access first responder of MFMessageComposeViewController
I'm interested in doing something similar to this, however the component subviews of MFMessageComposeViewController are a much different than MFMailComposeViewController. I figured out how to set ...
1 vote
2 answers
2k views
How do I make the keyboard go away when the user clicks somewhere else? [duplicate]
Possible Duplicate: Dismiss keyboard by touching background of UITableView How do I make the keyboard go away when the user clicks somewhere else? Note: I know how to make the keyboard disappear ...
1 vote
1 answer
1k views
tableView resize problem when pushing another view while keyboard is showing
I have a tableview controller under a navigation controller. Some of my table cells contain text fields, so when I tap on them, a keyboard will show up and automatically resize (shrink) the bounds of ...
4 votes
2 answers
733 views
Determine if responder chain will handle an action
The responder chain is cool. Particularly, being able to send custom actions to the first responder that will bubble up to anyone else that might be interested: [[UIApplication sharedApplication] ...
1 vote
2 answers
704 views
iOS get which uielement invoked UIKeyboardWillShowNotification
In my iOS app I have several UIElements that can process user input: textfields, editable webviews, etc. each time I write something into these UIElements the keyboard (obviously) will come up. Before ...
0 votes
2 answers
695 views
Capture text from UITextField in instance variable when another UIButton is pressed on UIView
I have a few UITextFields (within UITableViewCells) on my UIView with a "Save" UIButton. I want to do some basic validation on the UITextFields when the user clicks the "Save" button. I have ...
2 votes
2 answers
817 views
Programmatically discover identity of first responder
I want a UITextField to be sent the resignFirstResponder message if it is being edited and a user touches elsewhere on the screen. Since there are several text fields I need a way to programmatically ...
1 vote
1 answer
533 views
iOS Private API performSelector crash
Basically I want to get a list of action targets for a UIButton. I have gone through this and my question is slightly different because I do not know what the target is. All I have is a UIButton ...
0 votes
3 answers
257 views
How to move view when keyboard appear
I have multiple UITextFields and i need to move view up when keyboard appears. But I need to it only for 3 of bottom fields and doesn't want to move view for other field on top. I use this code, but ...
2 votes
3 answers
446 views
UITextView floating blue box when scrolling
I have a UITextView with scrolling disabled. It is inside a UIScrollView. If I type "fffs" a *little blue box appears. If I scroll while that box is displayed, the box doesn't disappear, it just **...
0 votes
3 answers
620 views
How to get change text from textfield
I have tableview with custom cells.The cell is having 2 textfields.From viewcontroller i need to find the changed text in that textfield. if i use * (BOOL)textField:(UITextField *)textField ...
0 votes
3 answers
547 views
Hide keyboard in iOS for any view?
There are similar questions but they are all about cases when they know which view is editing. In my case I have a local notification and I want to hide keyboard when app becomes active with it. In ...
1 vote
2 answers
467 views
Why "isFirstResponder" for UITouchEvent is returning false. When I touch a UIView
I having trouble in understanding First Responder. My Understanding is as follows. First Responder is the first object in the responder chain which gets first oppurtunity to handle Any UIEvent. UIKit ...
0 votes
2 answers
288 views
show Done button on number pad for multiple UITextFields
@Luda's answer is a great answer, but I got stuck when I needed to use it for multiple text fields so I edited it as the following: First, I get IBOutlets for each one of my textFields, say: ...