becomefirstresponder

Using becomeFirstResponder causes cancel button to not work

六眼飞鱼酱① 提交于 2019-12-13 03:43:52
问题 I have a UISearchDisplayController (searchDisplayCtr) and a UISearchBar (searchBar). I am trying to give focus to the search bar and bring up the keyboard when I click the search icon in the alphabet scroll on the right. If I include, [self.searchDisplayCtr setActive:YES]; [self.searchDisplayCtr.searchBar becomeFirstResponder]; It brings up the keyboard and selects the search bar but the cancel button does not work consistently. I have tried resigning first responder, setting active to NO and

UITextField in inputAccessoryView won't becomeFirstResponder

萝らか妹 提交于 2019-12-13 02:15:40
问题 I have a view called songInfoView with 3 UITextFields and a UIButton. I create a temp UITextField in the parent view to bring up the keyboard and assign songInfoView as the inputAccessoryView. This works as expected. Then, I try to set a text field in songInfoView as first responder. The cursor moves to this field, but when I try to type, nothing happens. I can tap on the text field and type as expected, but I want it to work without having to tap on it. Am I missing something? Am I doing

UITextfield becomeFirstResponder returns NO

冷暖自知 提交于 2019-12-13 01:34:00
问题 I have implemented the standard 'next' feature on UITextFields in my app (pressing next will move you to the next appropriate text field). Most of the time this works well and will move to the appropriate textfield no problem. However on a few occasions for some reason the textField will return NO when i ask it to become the first responder and I am not sure why. Some information about the textfields/view: The view has multiple UITableViews, some of the UITableViewCells in these have the

Move From UITextField to UITextView When Return Pressed

╄→гoц情女王★ 提交于 2019-12-11 12:44:57
问题 I have several text views in my app. All but one are UITextField, and the other is a UITextView, located right in the middle of the others. This is due to this section needing much more room for the user to type and see all of what they are typing out. I have it set up so that when the user presses next on the keyboard, it goes to the next field, using this code: - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == firstName) { [firstName resignFirstResponder]; [lastName

text becomeFirstResponder throws EXC_BAD_ACCESS Code=1 Address=0x1

試著忘記壹切 提交于 2019-12-11 05:44:18
问题 This is a Q&A to hopefully help anyone else who runs into this issue. The problem occurred seemingly at random while I was working on transferring the FirstResponder chain between controls. The controls were custom control objects inherited from UIView with either a UITextField or UITextView added as a subview (with other controls) and generated entirely in code. Not every instance of the controls that were generated threw the exception, but the ones that did did so consistently whether the

iOS - UIButton become first responder to open keyboard

早过忘川 提交于 2019-12-11 05:38:51
问题 I need to open keyboard on button click for UIButton (not using/for UITextField). I have tried to create custom button by overriding variable canBecomeFirstResponder but it's not working. Is there any other way to do so? Note: I want to set UIPIckerView as an input view of UIButton in key board frame. Here is my code. class RespondingButton: UIButton { override var canBecomeFirstResponder: Bool { return true } override init(frame: CGRect) { super.init(frame: frame) commonInit() } required

Cursor is blinking in UITextField but keyboard doesn't appear

戏子无情 提交于 2019-12-10 19:17:42
问题 I got a simple detail view with a textfield. In detail's viewController I wrote this code: - (void) viewDidAppear:(BOOL)animated{ [self.textField becomeFirstResponder]; NSLog(@"is textField 1st responder %d", [self.textField isFirstResponder]); } When I push the detail into a navigation controller, I see " is textField 1st responder 0 " in my log. The keyboard doesn't appear. But the textfield has blinking cursor. What happens in this moment? Why the keyboard doesn't appears? I did try to

How to show the keyboard for a UIView

喜夏-厌秋 提交于 2019-12-10 02:24:57
问题 I have a UIView where I want to receive keyboard input. I have tried: [self becomeFirstResponder]; But it doesn't work. I could implement a 'dirty' workaround by having a hidden UITextField and forwarding the keystokes to my UIView - but how does my UIView receive the keyboard input directly? 回答1: For a view to become first responder and show the keyboard, it must adopt and implement the UIKeyInput protocol. It must also override the canBecomeFirstResponder method to return YES. See “Simple

Swift: Become First Responder on UITextField Not Working?

只谈情不闲聊 提交于 2019-12-10 01:59:05
问题 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 calling resignFirstResponder() , but it returned false. Next I tried to find who the first responder is through looping all the subviews using the code over @ Get the current first responder without using a private API. It turns out none of the sub views are the first responder. My ViewController in

TextField becomeFirstResponder Issue for tab key(Keyboard) action

删除回忆录丶 提交于 2019-12-08 15:46:59
问题 I have a view in XIB where i used several text fields in it. Let say the first text field becomes first responder as soon as the view gets loaded in the window. If i press tab key in my machine's keyboard to navigate to next text field ;apart from the immediate text field, all other text fields are also becomes first responder and the textfield begin editing delegate menthod gets called for all the text fields. What could be the issue ? This will occur not only in simulator when we use