Search code examples
iosobjective-cxcodeswiftiphone-6-plus

Create iPhone Six Plus-Specific UI Elements (preferably with Autolayout)


In Apple’s Messages app on iOS, the iPhone 6 Plus displays contact images to the left of the names and message previews, which it does’t do on any of the other devices.

enter image description here

I was just wondering if there was a way to do this, preferably with Autolayout? I’m mainly confused because when choosing the layout size, it says at the bottom of Compact Width and Any Height that it’s for 3.5", 4" and 4.7" iPhones, with no mention of 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 of doing it with Autolayout, what’s the neatest method of doing it otherwise?

Thanks in advance for your help, and apologies if this appears to be a duplicate of anything; I’ve been searching around for quite a while and haven’t found anything that properly answers my question.


Solution

  • I'm guessing they test the screen width, and this is actually based on experience. On a jailbroken phone, you can manually change the resolution/scale, and anything even slightly higher than the native 6 resolution (this was on an iPhone 6) added in the 6+ features. So, while you might still use auto layout to lay out the additional things, you would test the UIWindow width to see if you should install those elements.

    Edit: I haven't tried this, but you might be able to use optionals to do this. i.e. (pseudo-code):

    var contactIcon: UIImageView?
    
    // in viewDidLoad or something
    if screen.width > 475 {
        contactIcon = UIImageView(named: "contactphoto.png")
    }
    
    // in the layout code:
    contactIcon?.autoSetDimensions(size)
    // etc.