Create an iPhone with 6-plus UI elements (preferably with Autolayout)

In the Apple Apps app on iOS, the iPhone 6 Plus displays contact images to the left of names and previews of messages it makes on any other device.

enter image description here

I'm just wondering if there is a way to do this, preferably with Autolayout? I'm mostly confused because when choosing the size of the layout, it says at the bottom of the compact width and any height that's for 3.5 ", 4" and 4.7 "iPhone, without mentioning the 5.5" iPhone 6 Plus.

enter image description here

If I'm completely barking up the wrong tree here and there is absolutely no way to do it with Autolayout, then what's the easiest way to do it otherwise?

Thanks in advance for your help and apologize if this looks like a duplicate of anything; I searched for a long time and did not find anything that would answer my question.

+3


source to share


2 answers


I am assuming they are checking the screen width and this is actually based on experience. On a hard phone, you can manually change the resolution / zoom, and anything even slightly higher than the native 6x resolution (it was on the iPhone 6) added in 6+ features. So while you can still use auto-layout to lay out additional stuff, you should check the width of the UIWindow to see if these elements should be set.

Edit: I haven't tried this, but you could use options to do this. that is (pseudocode):



var contactIcon: UIImageView?

// in viewDidLoad or something
if screen.width > 475 {
    contactIcon = UIImageView(named: "contactphoto.png")
}

// in the layout code:
contactIcon?.autoSetDimensions(size)
// etc.

      

+1


source


I can't answer how to do this in IB, but how to do it in code: according to the docs, it [[UIDevice currentDevice] platform]

returns a string identifying the exact version of the iPhone model that works, eg. iPhone 5s, iPhone 6 plus, etc.

You can check the code for the device like this:

 NSString *platform = [self platform];
 if ([platform hasPrefix:@"iPhone7,1"]) {
      //iPhone 6Plus
 }
 else {
      //other devices
 }

      



I have collected all iOS devices with enums in category UIDevice

:

UIDevice + BHRExtensions.h , UIDevice + BHRExtensions.m

+1


source







All Articles