How to detect host app is in Zoom mode or Normal mode in iPhone 6 Plus?
Asked Answered
A

1

6

Assume iPhone 6 Plus display is in standard mode (Settings > Display > View > Standard), the UIInputViewController inputView of a keyboard extension returns different widths depends on whether the host app is optimised for the iPhone 6/iPhone 6 Plus screen.

For example, the built-in Notes app returns width as 414 points (not zoomed), where the LINE app (as of v4.7.2) returns 320 points (zoomed).

How can a keyboard extension determine the width of the host app window (say, in viewDidLoad, before viewDidiLoad)?

Athletic answered 21/11, 2014 at 9:43 Comment(0)
W
0

You can use the defined macros:

#define IS_OS_8_OR_LATER    ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && ([[UIScreen mainScreen] bounds].size.height == 568.0) && ((IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale) || !IS_OS_8_OR_LATER))
#define IS_STANDARD_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0  && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale)
#define IS_ZOOMED_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0 && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale > [UIScreen mainScreen].scale)
#define IS_STANDARD_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
#define IS_ZOOMED_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0 && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale < [UIScreen mainScreen].scale)

Or [UIScreen mainScreen].nativeScale witch will gives you 2.6f if normal, and 2.8f if zoomed on iPhone 6 plus

Warrington answered 18/9, 2015 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.