假设iPhone 6 Plus显示器处于标准模式(设置>显示>视图>标准),键盘扩展的UIInputViewController
inputView
返回不同的宽度取决于主机应用是否是针对iPhone 6 / iPhone 6 Plus屏幕进行了优化。
例如,内置的Notes应用程序返回宽度为414点(未缩放),其中LINE应用程序(从v4.7.2开始)返回320点(缩放)。
键盘扩展如何确定主机应用窗口的宽度(例如,viewDidLoad
之前的viewDidiLoad
)?
答案 0 :(得分:0)
您可以使用已定义的宏:
#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)
或[UIScreen mainScreen].nativeScale
如果正常,2.6f
女巫会给你2.8f
,如果放大iPhone 6加Employee
CompanyId EmployeeId RecordDate Name
1 1 2011/04/11 Kate Windsor
1 1 2010/07/04 Kate Middleton
EmployeeTasks
CompanyId EmployeeId RecordDate TaskId TaskCode
1 1 2015/09/18 1 bbb
1 1 2015/09/18 1 aaa