ASPECT RATIOS & AUTOLAYOUT

ASPECT RATIOS & AUTOLAYOUT

Auto Layout at first seems to be very boring and unresponsive, did you felt the same ? The first time I started with I was unable to achieve the layout with all those new constraints. Well once you master it you will feel its the game changing feature of iOS development.

You all might have heard about Retina images @2x images and @3x images and their roles in designing layout for iPhone 5, iPhone 5s, iPhone 6 & iPhone 6+. If you are not aware about the same I would highly recommend to learn that first before reading next para.

In auto resizing we dont have to do anything extra or we did not have to worry about the height & width for 5, 6 & 6+ it would automatically take the images of @2x & @3x and it will auto adjust the height & width but alas thats not the case with auto layout.

If you want the image sizes to be proper & perfect you will need to work with Aspect Ratios, Ahhh what that now ? Its easy consider you have logo image of size 150 * 150 for @1x, 300 * 300 for @2x & 450 * 450 for @3x. You want these respective height & width to be proportional  in all devices. To achieve that we can not give constraints of Fixed height 150 and fixed width 150.

For that we need to provide aspect ratio as 150:320 in width & 150:480 in height as showed below.

Anil Sharma

Engineering Lead

9 年

????

回复

要查看或添加评论,请登录

BhuShan PaWaR的更多文章

  • iOS 11?—?Core ML

    iOS 11?—?Core ML

    I introduced Core ML which is a general machine learning framework. Apple also provide frameworks for specific areas.

  • Protocol-oriented Programming in Swift

    Protocol-oriented Programming in Swift

    Protocols are used to define a “blueprint of methods, properties, and other requirements that suit a particular task or…

    1 条评论
  • iOS 10 Push Notifications

    iOS 10 Push Notifications

    Images, GIFs, Audio and Video You can now send rich media in a push notification, including images, GIFs, audio, and…

    3 条评论
  • Apple Keynote Event (September 7, 2016)

    Apple Keynote Event (September 7, 2016)

    Apple has launched the two new members of IPhone Family. iPhone 7 and iPhone 7 Plus.

  • NSURLConnection to NSURLSession

    NSURLConnection to NSURLSession

    got its start a decade ago, with the original release of Safari in 2003, as an abstraction on top of the Core…

    3 条评论
  • Apple Pay

    Apple Pay

    Mobile payments are the hot phrase of the season. Since Apple Pay’s announcement in 2014 and now Samsung and…

  • IMPLEMENTING SPOTLIGHT IN YOUR APP

    IMPLEMENTING SPOTLIGHT IN YOUR APP

    Hey Readers, hope you have a great time reading the posts, today we will have a quick look at Spotlight search feature…

  • WHATS NEW IN IOS 9

    WHATS NEW IN IOS 9

    Multitasking Enhancements for iPAD For Multitasking on iPAD, iOS 9 has introduced bunch of new views which are : Slide…

    1 条评论
  • IOS9

    IOS9

    Apple has been always improvising the iOS & developer tools this time keeping in mind the smaller size devices like 8…

  • DEEP LINKING

    DEEP LINKING

    Deep Linking at first seems to be very heavy & new concept but its actually very useful. But lets first understand what…

社区洞察