swift iOS place view over keyboard

632 Views Asked by At

I am working on a view in my app involves 3 main parts:

  • A custom in-app keyboard
  • A 'Controller' view, which is actually another ViewController in a container view with multiple controls and the textField that has my custom keyboard as inputview
  • Lastly, a view that displays the entered data.

Now, I am working on an proper design for this screen and I figured it would look good if a small part of my 'Controller' view would overlap the keyboard I have. I tried things like:

  • Added everything, including the keyboard into a stack view which gets it underneath the view I want, until you select or de-select the textField when it just displays another keyboard on top of it all
  • Tried, as multiple other SO Answers suggest, to add it in the same window as the Keyboard is in with: UIApplication.shared.windows[UIApplication.shared.windows.count - 1].addSubview(textController.view) which results in a crash: child view controller: View should have parent view controller:(null) but actual parent is: PresentingViewController
  • Manipulating the z-position of the 'Controller' view to float. Float.greatestFiniteMagnitude but won't get it on top of the keyboard.

Question: What is the best way to get the view of a container view on top of the keyboard in iOS?

0

There are 0 best solutions below