2nd uitextfield in modal view not taking keyboard input - ipad

I am presenting my modal view using UIModalPresentationFormSheet and I am aware some have had issues resigning first responder and dimissing the keyboard in the past, but my issue is that the second textfield I pick I can't input text. This is hapenning in iPad simulator 4.3.
This happens if I select the second uitextfield while the keyboard of the first textfield is still visible. The cursor will move to the second textfield, but I am unable to edit it. Most of the time I am unable to click the bottom right button which would dismiss the keyboard in iPad, but if it works, I can then select the second textfield and be able to edit it.
Has anyone encountered these issues before?
I am also implementing
-(BOOL)disablesAutomaticKeyboardDismissal { return NO }
Even though this is not a solution it is a workaround. Basically you use a pagesheet instead of form, and resize it.
UIModalPresentationFormSheet resizing view

Even though this is not a solution it is a workaround. Basically you use a pagesheet instead of form, and resize it.
UIModalPresentationFormSheet resizing view

Related

Keep UITextField focused when presenting UIView as modal

As you can see in the below gif there is a flash as the keyboard momentarily dismisses as the input in the home screen loses focus and reopens as the text field in the second screen gains focus. Is there a way to keep the keyboard open while as the modal is presented?
My not be the right answer but when you are dismissing the view, how are you going about this?
If you are dismissing the first responder, I'm imaging that the first responder is in fact the keyboard on the first view. Are you dismissing the keyboard and then dismissing the view or is it doing that automatically when you are dismissing the view and the keyboard belongs to the first view? Could you try and add some kind of tag to the textField's and then before dismissing the view and moving to the second view, assign the first responder to be the textField in the second view?
Sorry, can't comment yet due to reputation.

iOS Button not fully rendered after push transition

I have a view controller that when a subclass UIButton is tapped, it pushes another view controller. The problem is that I have another button of the same subclass on the newly presented view controller but when it appears it's cut off.
This problem solves itself when I tap a keyboard key and if I tap "Debug View Hierarchy" it appears fully drawn in Xcode and when I exit debugging it's fully drawn.
Here's an example of the problem in an iPhone XS Max iOS 12.1 and Swift 4.2 (I've covered with a red rectangle some text fields since they have user details but they're are subclasses of UITextField and the card view is a child view controller with a UICollectionView):
This is what I get
This is what I expect
I have tried putting setNeedsDisplay and layoutIfNeeded for the button and its superview inside viewDidAppear and viewWillAppear but I haven't been able to determine what's happening and how to solve it. I would really appreciate if someone could help me. Thank you!
I think this is not a rendering issue and its another view on top of the button. Try more investigating in view debugger
Then see what it is. (check other UIWindows)
I guess it's keyboard suggestion's view. or some footer view or etc.
It looks like the keyboard’s ´inputAccessoryView´ is getting in the way.
You can try disabling it.

After Modal Dismissal, keyboard displays the wrong color - iOS

I have a question in regards to the color of the keyboard after a modal is dismissed. Basically, the flow goes like this...
I press a toolbar button on a keyboard that brings up a modal view controller.
That modal view controller dismisses itself and then calls a method on the presenting view controller that makes a text field first responder.
Here are some photos
Weirdly colored keyboard
Normal keyboard
In case it helps, I can get from the weirdly colored keyboard to the normal keyboard by pressing the shift key.
I saw this happen when I inadvertently tried to make my input field first responder twice and also when I let the system resign and re-establish first responder around my modal
I fixed the problem by manually resigning first responder before my modal was presented, and then manually becoming first responder again after my modal was dismissed.
You might just try manually resigning first responder before you present your modal.

How to display virtual keyboard in ios6 Simulator

How do you display the virtual keyboard in ios6 Simulator (iphone or iPad) ? I've tried the toggle keyboard option, but nothing appears, can you only make it appear with code? and if so, how?
Thanks for any advice.
You can't show the keyboard without a 'target'. The system needs to know where it should send the entered text to.
So if you have a subclass of UIView that accepts text input (UITextField for example), the keyboard is either shown when the user taps that view or you can programmatically trigger it by calling:
[textField becomeFirstResponder];
From iOS-Documentation Managing the Keyboard:
Displaying the Keyboard
When the user taps a view, the system automatically designates that view as the first responder. When this happens to a view that contains editable text, the view initiates an editing session for that text. At the beginning of that editing session, the view asks the system to display the keyboard, if it is not already visible. If the keyboard is already visible, the change in first responder causes text input from the keyboard to be redirected to the newly tapped view.
Because the keyboard is displayed automatically when a view becomes the first responder, you often do not need to do anything to display it. However, you can programmatically display the keyboard for an editable text view by calling that view’s becomeFirstResponder method. Calling this method makes the target view the first responder and begins the editing process just as if the user had tapped on the view.
If your application manages several text-based views on a single screen, it is a good idea to track which view is currently the first responder so that you can dismiss the keyboard later.

Displaying the keyboard above the toolbar?

I have an ipad app with a single textfield. When the user clicks in the textfield, I want the keyboard to come up without moving or covering the toolbar at the bottom of the screen. The closest I've come to this is the following:
[textField setInputAccessoryView:toolBar];
There are two problems with this.
The keyboard pushes the toolbar up when it appears.
When the keyboard is dismissed, it takes the toolbar with it!
If I could fix 2, then I could probably live with 1, but I'd rather find a solution to both. Thanks!
EDIT: I give up on fixing 1 based on TomSwift's answer, but can someone please tell me if there is a way to push up the toolbar when they keyboard appears and then drop the toolbar back in place when the keyboard disappears???? THANKS!
I'm pretty sure you dont have this option. In iOS the keyboard position is controlled by the OS - you can get notifications of where it is but I dont think you can control where it goes. What you're asking for is to slide the keyboard in and keep going until it's "above" your toolbar at the bottom of the screen.
Have you seen any other apps that do this?
The toolbar disappears upon hiding because it has been added to another view, and therefore removed from its original view. You'll need to re-add it as you initially did.

Resources