Unified Contacts

Showing posts with label iPhone 6 Plus. Show all posts
Showing posts with label iPhone 6 Plus. Show all posts

15 April, 2015

Default Behavior of UIPopoverPresentationController Changed in iOS 8.3

I have working with an adaptive app that can run on all size class. Before updating to iOS 8.3, the popover behavior is the same in iPad and iPhone 6 Plus landscape mode. However, after updating to iOS 8.3, the popover in iPhone 6 Plus has changed to FormSheet. This is because the popover now not only check the horizontal size class, but also the vertical size class. Popover will present normally in vertical regular like iPad, and present as FormSheet in vertical compact. So how can we fix it?

Below is the old method to disable the adaptivity of popover in horizontal compact. But it not enough in iOS 8.3.

In the demo of WWDC 2014 Session 214 "View Controller Advancements in iOS 8", Bruce explained a trick that let you present popover in horizontal compact environment (e.g. iPhone). Without this trick, the popover will be presented in modal. Let take a look what is the trick.

func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
    return UIModalPresentationStyle.None
}

This function in UIAdaptivePresentationControllerDelegate can modify the UIModalPresentationSytle when the device is changed from horizontal regular to horizontal compact. By return .None, popover will no longer adaptive to horizontal compact and will presented in popover just like that in horizontal regular.

Okay, we now know that popover check now check both horizontal and vertical size class. Therefore, we need to use a new funcation. Apple introduced a new function in iOS 8.3 which let you determine the UIModalPresentationStyle by the TraitCollection.

func adaptivePresentationStyleForPresentationController(controller: UIPresentationController!, traitCollection: UITraitCollection!) -> UIModalPresentationStyle {
    return UIModalPresentationStyle.None

}

This new function can be used to replace the old function. I have disabled the adaptivity of popover in whatever size class and everything works just like in iOS 8.2.

Reference: iOS 8.3 API Diffs

12 September, 2014

Size Classes for iPhone 6 Plus

I talked about Unified Storyboard before. On that time, many other developers was discussing about a unknown combination, regular width + compact height. And we know it today, this is iPhone 6 Plus.


Apple has updated the online document of "What's New in iOS". At this moment, iPhone 6 Plus is the only iOS device which has this size classes. And iPhone 6 Plus also is the only device support @3x image. When developing app for iPhone 6 Plus, you have to design app for 2208 x 1242 resolution. That's mean the @1x development environment is 736 x 414. And when iPhone 6 Plus runs the app, it will virtually downsize to 1920 x 1080.


iPad Portrait
iPad Landscape
iPhone Portrait
iPhone Landscape
iPhone 6 Plus Landscape



我在較早之前討論過 Unified Storyboard . 那個時候, 很多開發者都已經在討論一個未知的組合, regular width + compact height. 今天我們知道了, 這就是iPhone 6 Plus.



Apple已經更新了網上的文件"What's New in iOS". 現在, iPhone 6 Plus是惟一的iOS裝置擁有這種size classes. 還有iPhone 6 Plus也是惟一支援@3x的圖象. 當開發iPhone 6 Plus的app時, 你必需用2208 x 1242解像度. 這表示@1x開發環境是736 x 414. 當app在iPhone 6 Plus上運行時, 會自動向下調整至1920 x 1080.


iPad Portrait
iPad Landscape
iPhone Portrait
iPhone Landscape
iPhone 6 Plus Landscape