"iOS Dev-120" How to use size Classes in storyboard is actually setting up multiple sets of AutoLayout

Source: Internet
Author: User

(1) Use size Classes in storyboard.

We have used AutoLayout before, and now we have a size Classes, which can be seen as AutoLayout settings under different size Classes.

Detailed tutorials, http://www.cocoachina.com/ios/20141020/9978.html


--Seemingly, storyboard's functions are becoming more powerful. The adaptation of different sizes and screens is enough to make it a pain to hit the code.

--Find a lot of blog posts, found that almost all talk about how to use size classes in storyboard, almost no code to achieve size classes.

Reference from Joywii ' s Blog:ios8 Size classes Understanding and use

-(void) Willtransitiontotraitcollection: (uitraitcollection *) newcollection               withtransitioncoordinator: (ID < uiviewcontrollertransitioncoordinator>) coordinator{    [Super Willtransitiontotraitcollection:newcollection                  Withtransitioncoordinator:coordinator];    [Coordinator animatealongsidetransition:^ (ID <UIViewControllerTransitionCoordinatorContext> context)     {        if (Newcollection.verticalsizeclass = = uiuserinterfacesizeclasscompact) {            //to do:modify something for Compact vertical Size        } else {            //to do:modify something for other vertical size        }        [Self.view setneedslay Out];    } Completion:nil];}

in two to do, we want the handwritten code to be adjusted for different states.


iOS Dev-120 How to use size Classes in storyboard is actually setting up multiple sets of AutoLayout

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.