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
5
votes
3 answers

How to close window (NSWindowController) by hitting the ESC key?

Issue I would like the user being able to close a window by hitting the ESC key but I can't get it to work in this specific case, hitting ESC triggers an error sound (the "no you can't do that" macOS bloop) and nothing happens. Context I'm making a…
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
5
votes
3 answers

resignFirstResponder causing EXC_BAD_ACCESS

I've got a UITextField on UITableViewCell, and a button on another cell. I click on UITextField (keyboard appears). UITextField has the following method called: - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { NSLog(@"yes, it's…
kolinko
  • 1,633
  • 1
  • 14
  • 31
5
votes
3 answers

[NSTaggedPointerString objectAtIndex:]: unrecognized selector sent to instance

I have a problem with every UITextfield in my app. Whenever an instance of UITextfield becomes first responder, my app crashes with the following error message. Some details about the app: multi language support using storyboards My app used user…
Webdevotion
  • 1,223
  • 13
  • 24
5
votes
4 answers

UISearchBar losing focus

I have a UISearchBar for a UITableView and my implementation is as follows: -(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { [self.searchBar becomeFirstResponder]; if(searchText.length == 0) { …
Giardino
  • 1,367
  • 3
  • 10
  • 30
5
votes
3 answers

Hide keyboard on touch anywhere outside UITextField when view includes UICollectionView

There are some answers out there such as this, but in the case where there is a UIScrollView or UICollectionView present, it doesn't work. The touchesBegan method on the viewController will never get called. On screen, I have a UITextField at the…
soleil
  • 12,133
  • 33
  • 112
  • 183
5
votes
0 answers

UISearchBar becomeFirstResponder not showing keyboard

Something peculiar is happening in my code with my UISearchBar and I can not figure out what is happening. In my application I have a view controller set up as follows View Controller A ---> View Controller B On View Controller A, I have a toolbar…
Abhay Curam
  • 75
  • 2
  • 6
5
votes
1 answer

UITextField inside UITableViewCell won't become first responder

I use a UITableViewController to display the details of KoreanFood. The first cell is a custom UITableViewCell (OverviewCell) with an Image and two UITextFields, which I created and layout in Storyboard (AutoLayout). I subclassed UITableviewCell…
fruitcoder
  • 1,073
  • 8
  • 24
5
votes
1 answer

UIVIew endEditing:YES doesnt hide the keyboard

I have a UIVIew which is a subview and it contains several UITextFields. One of these textfields (which is for DATE) should not be editable using the keyboard, instead of this I use a PopOver with a Datepicker inside. I run a method when the…
chost
  • 75
  • 1
  • 6
4
votes
1 answer

Error when making UITextField subView a first responder in UITableView

I am trying to create a UITableView in which you create a new item by pulling the whole table down. Similar to Clear app http://www.realmacsoftware.com/clear/. I am adding a UITextField addingTaskTextField = [[UITextField alloc]…
makeshifthoop
  • 127
  • 1
  • 8
4
votes
4 answers

Vanishing NSTextField Text

I have a custom view in a .xib file, which I use as the contentViewController for an MAAttachedWindow. The view has several NSTextFields in it. When I open the MAAttachedWindow first time, everything is fine. Text shows up in all relevant text…
Patrick Perini
  • 22,555
  • 12
  • 59
  • 88
4
votes
2 answers

NSTableView hit tab to jump from row to row while editing

I've got an NSTableView. While editing, if I hit tab it automatically jumps me to the next column. This is fantastic, but when I'm editing the field in the last column and I hit tab, I'd like focus to jump to the first column of the NEXT row. Any…
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
4
votes
3 answers

NSOpenGLView, NSWindow & NSResponder - makeFirstResponder not working

In the code below I am Initialising a NSViewController [a NSResponder], with a NSWindow, a NSOpenGLView, presenting the view and attempting to set the NSViewController as the windows first responder. It is not working. I was expecting to be able to…
Seamus
  • 1,107
  • 10
  • 22
4
votes
5 answers

Problems setting FirstResponder in Cocoa Mac OSX

Im working on a tiny app just to learn cocoa, and Im having a hard time with setting FirstResponder to some NSTextFields. When the view opens, I want the first NSTextField, clientNumber, to be selected, so I trigger [clientNumber…
4
votes
2 answers

UiTextField and resignFirstResponder

I have a weird setup. I have a View called View1 and a ViewController call viewController1 in IB, View1 is a child of the ViewController1. Inside View1, I created using code a UITextField and added as a subview. In my Viewcontroller, I have…
user82383
  • 879
  • 3
  • 11
  • 31
4
votes
0 answers

How to make WKWebView the first responder and respond to keyboard shortcuts after scrolling?

I've laid out a couple WKWebViews in SwiftUI (using UIViewRepresentable) for an iPad app. When I simply click on one those views, it gets focus, and I can use various keyboard shortcuts specific to the website (in the example code below the pages…
cannyboy
  • 24,180
  • 40
  • 146
  • 252