4

My Custom keyboard has presets for each screen resolution of all Apple devices. So I have iphone, iphon5, iphone6, iphone6plus and ipad presets.

But in case user runs iPhone app (like instagram) on iPad, I need to load iphone keyboard preset and use its geometry.

Also iPhone 6 and 6+ can use stretched mode, when apps run like iPhone 5 app being stretched.

So determining UI_USER_INTERFACE_IDIOM is not a solution. Keyboard extension and host app can see screen geometry in different ways, so I am stuck here. Need to get at least application frame for host app or any other explicit way to get that geometry.

App and keyboard extension see geometry different ways: App and keyboard extension see geometry different ways

Also Swift key seems to have same bug while running hosted inside of iphone app on ipad screen.

Swiftkey inside iphone app on ipad: Swiftkey inside iphone app on ipad

NG_
  • 6,895
  • 7
  • 45
  • 67
Modo Ltunzher
  • 648
  • 5
  • 12

1 Answers1

0

I just found a way to check isPad on keyboard extension but I cannot make sure it is best way.

UI_USER_INTERFACE_IDIOM() && YourKeyboardViewController.instance.view.bounds.size.width == UIScreen.mainScreen.bounds.size.width

You should do this after YourKeyboardViewController.instance did called viewWillAppear(), after that the view.bounds did changed to 320x480 from 768x1024.

Shawn Clovie
  • 38
  • 1
  • 5