Questions tagged [first-responder]

In Apple Cocoa programing, the first responder is the first object in a chain of NSResponder subclasses to be called upon receiving an even such as keypress, mouseclick, etc.

409 questions
365
votes
28 answers

Get the current first responder without using a private API

I submitted my app a little over a week ago and got the dreaded rejection email today. It tells me that my app cannot be accepted because I'm using a non-public API; specifically, it says, The non-public API that is included in your application is…
Justin Kredible
  • 8,354
  • 15
  • 65
  • 91
217
votes
13 answers

iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheet

Note: See accepted answer (not top voted one) for solution as of iOS 4.3. This question is about a behavior discovered in the iPad keyboard, where it refuses to be dismissed if shown in a modal dialog with a navigation controller. Basically, if I…
Kalle
  • 13,186
  • 7
  • 61
  • 76
171
votes
22 answers

SwiftUI: How to make TextField become first responder?

Here's my SwiftUI code: struct ContentView : View { @State var showingTextField = false @State var text = "" var body: some View { return VStack { if showingTextField { TextField($text) …
Epaga
  • 38,231
  • 58
  • 157
  • 245
91
votes
1 answer

What are File Owner and First Responder in iOS - Xcode?

What are File Owner and First Responder in iOS - Xcode?
Matrix
  • 7,477
  • 14
  • 66
  • 97
58
votes
22 answers

Cannot set searchBar as firstResponder

I have a searchBar I'm setting in a tableviewcontroller. i've referenced this similar question UISearchBar cannot become first responder after UITableView did re-appear but am still unable to set it as first responder. In .h file: @property…
49
votes
5 answers

Telling a UITextField to become first responder while embedded in a UITableViewCell

I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I am trying: [myTextField…
Jasarien
  • 58,279
  • 31
  • 157
  • 188
42
votes
11 answers

iOS app "next" key won't go to the next text field

I have a simple scene (using storyboard in IB) with a Username and Password text box. I've set the keyboard to close when you are on the Password text field but can't get the next(return) button to work on the Username to switch the focus (or First…
BamBamBeano
  • 464
  • 4
  • 13
  • 24
31
votes
4 answers

"First Responder" - Did I get that right?

Let me summarize this shortly: A "First Responder" in a nib file is an object, which represents the UI control element that has the user's focus. So if the user clicks on a control, the nib sets that clicked UI control as First Responder. In my app…
Thanks
  • 40,109
  • 71
  • 208
  • 322
30
votes
4 answers

get notified when UITextField becomeFirstResponder

How I can get notified when UITextField becomeFirstResponder ? I can check like isFirstResponder or set to to become first Responder by becomeFirstResponder I want to get notified or handle an event when a user make this text field first…
shebelaw
  • 3,992
  • 6
  • 35
  • 48
28
votes
2 answers

Unwanted automatic scrolling with UIScrollView and UITextFields as subviews

The "too long; didn't read" version: Is there any way to disable the automatic scrolling behaviour of UIScrollView when telling a UITextField to becomeFirstResponder? I have a scroll view with paging enabled and several views as subviews, each…
Jasarien
  • 58,279
  • 31
  • 157
  • 188
23
votes
3 answers

What is a formal definition of a first responder in iOS?

I understand that a first responder object is the receives a callback signal according to input activity, etc and that it will bubble it up the chain until a responder willing to handle it can be found. But more formally, what is the scope of the…
Joey Carson
  • 2,973
  • 7
  • 36
  • 60
22
votes
1 answer

Make UISearchBar first responder when View Loads

I have a simple UIViewController and a UISearchBar, when the view loads I want to have the search bar become the first responder right away so that the keyboard is showing and they can start typing their query right away. I tried doing it in…
John Duff
  • 38,090
  • 5
  • 35
  • 45
22
votes
3 answers

Why is becomeFirstResponder not working?

I added a modal using AGWindowView. Inside the modal view (built using IB), there is a textfield. The textfield has been connected to an outlet. This doesn't work: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; …
Ravi
  • 7,929
  • 6
  • 38
  • 48
21
votes
10 answers

iphone UISearchBar Done button always enabled

I have a UIViewController with a UISearchBar. I have replaced the Search Button by a Done button. However, when one taps on the searchbar, the Done button is initially disabled. This occurs until one enters any character. What I want to do is to…
David Homes
  • 2,725
  • 8
  • 33
  • 53
20
votes
3 answers

iOS unit test: How to set/update/examine firstResponder?

How do you write first responder unit tests? I'm trying to write a test to confirm that a method advances focus to the next text field. controller is a descendant of UIViewController. But this exploratory test fails: - (void)testFirstResponder { …
Jon Reid
  • 20,545
  • 2
  • 64
  • 95
1
2 3
27 28