I built a keyboard for iOS 8 using one xib file and multiple subviews. However this keyboard only works in portrait mode and when the device rotates, the keyboard doesn't change its size or length. I figured I need to create another xib file with subviews for landscape and when the device rotates have the xib files switch. My question is how would I go about accomplishing this? How would I make it so that the program knows when to switch xib files. I was thinking I should use something like what is proposed in here: https://stackoverflow.com/a/25222353/2057171 but I do not know how I would implement it. Any help is appreciated.
One xib for both portrait and landscape
It's possible to have only one xib for both portrait and landscape, if you enable autolayout on your views in your xib file. These are the steps I did in my own test keyboard.
"inputView" automatically changes sizes when switching between portrait and landscape, so when you have constraints setup for your view in relation to "inputView", your view will adjust automatically.
Separate xib for portrait and landscape
If you do decide to have separate xib files for your portrait and landscape views, you might need to load and add the correct subview to inputView whenever the orientation changes. I haven't done this personally but I believe updateViewConstraints() is called whenever the orientation changes so you can implement your logic there.