How to determine if the iPhone 6+ (plus) is in Standard or Zoom mode
How about just checking the bounds
(not nativeBounds
) of the screen? IIRC, in zoom mode the bounds will be {375, 667}
but in regular mode they are {414, 736}
.
But yes, as mentioned in the comments.. if you are using AutoLayout, your app should "just" be able to adjust itself correctly and you shouldn't need to know.
How to detect iPhone 6 & 6 Plus View Mode Programmatically
You can use either [UIScreen mainScreen].nativeScale
witch will gives you 2.6f
if normal, and 2.8f
if zoomed on iPhone 6 plus, or 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)
Does iPhone 6 / 6 Plus simulator supports changing of Display Zoom mode?
Display Zoom is not available in the simulator (as of Xcode 6.0).
How to detect iPhone 6 or iPhone 6 Plus view size mode programmatically
This works for me tested in iphone 6+ and 6s+
if #available(iOS 8.0, *) {
print("ios greater than 8")
if(UIScreen.mainScreen().bounds.size.height == 667.0 && UIScreen.mainScreen().nativeScale < UIScreen.mainScreen().scale){
// iphone 6+ and 6s+ are in zoomed
print("iphone 6+ and 6s+ zoomed ")
}else{
// iphone 6+ and 6s+ are in standard
print("iphone 6+ and 6s+ standard ")
}
}else{
print("ios less than 8")
}
thanks @k8mil
Related Topics
When and Why Should You Use Nsuserdefaults'S Synchronize() Method
Method 'Application:Openurl:Options:' Is Not Called
Close iOS Keyboard by Touching Anywhere Using Swift
Uicollectionview, Full Width Cells, Allow Autolayout Dynamic Height
Uibutton: Making the Hit Area Larger Than the Default Hit Area
How to Add Multi-Line Text to a Uibutton
Do I Need to Disable Nslog Before Release Application
Add Views in Uistackview Programmatically
How to Load a Uiimage from a Url
Enterprise App Update Distribution on iOS 8
Table Header Views in Storyboards
I Have Real Misunderstanding With Mfmailcomposeviewcontroller in Swift (Ios8) in Simulator
Swift Nsdateformatter Not Working
Codesign Error: Provisioning Profile Cannot Be Found After Deleting Expired Profile
Best Way to Add License Section to iOS Settings Bundle
Uibutton: How to Center an Image and a Text Using Imageedgeinsets and Titleedgeinsets