Safe Area on custom Input View

My app loads a custom Input View from an XIB and most of the time presents it as it should without incident. However every so often the Input View will present while seemingly ignoring the Safe Area margins on iPhone X. When this happens, rotating the device 90º causes the Safe Area margins to kick in.

I've been unable to find a consistent method to reproduce this bug so it seems to be happening at random and only seems to be happening on physical hardware. Has anyone else run into this (or something similar) or does anyone have any suggestions / workarounds?

Here is what it's suposed to look like and here's what it looks like when it glitches.

A snippet of the code that sets up the custom Input View is below incase I'm just missing something obvious:


//Load the numeric keypad for the iPhone
NumericKeyboardViewController *numericKeyboardViewController = [[NumericKeyboardViewController alloc] initWithNibName:@"NumericKeyboardPhone" bundle:nil];

//Configure the Done & Hide Keyboard buttons
[numericKeyboardViewController setShowDone:buttonDone];
[numericKeyboardViewController setShowHideKeyboard:buttonHideKeyboard];

//Configure the keypad for the iPhone
[numericKeyboardViewController.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth];

//Configure the originating view
[numericKeyboardViewController setOriginatingView:self.view];

//Set the numeric keyboard as the textfield's input view
[textField setInputView:numericKeyboardViewController.view];

Replies

Where do you set the position of the keyboardview ? In setOriginatingView ?

How do you take into account bottomPadding ?

bottomPadding = window.safeAreaInsets.bottom


PS: how did you manage setShowDone to adapt when rotating device ? I have had problem to position the additional key in the right place under the key "7"