iOS Interface layout Finishing

Source: Internet
Author: User

1 UIView

1.1 Creating a custom UIView xib file

[1] Setting the class in the custom class of file ' s owner to execute the customized control classes

[2] Setting the screen size of the current UIView

Simulated Metrics Size is Freefrom, other bar options are set to None

[3] Two ways to load custom controls are implemented

-(ID) initWithFrame: (CGRect) frame//general how to set the frame build control in code

-(ID) Initwithcoder: (Nscoder *) Adecoder//build control via Xib file load mode

-(void) awakefromnib

[4] Gets the current control's frame

Self.frame;

[5] Getting a custom nib control in a custom control

nsbundle* Bundle=[nsbundle Mainbundle];

views= [Bundle loadnibnamed:@ "UIMainMenuButton1" owner:self Options:nil];

uiview* Uiview=[views objectatindex:0];

[6] Setting custom properties

To add a custom property to a class

Select the class in the Xib file that adds the custom class and add the user defined runtime attributes in the show the Identity Inspector Tab

      

[7] The custom control cannot calculate the actual width height of the current control, but the system comes with controls such as Uilabel can calculate the actual width of the height,

Must be height, and width in auto layout settings

[8] Cut content

Set Clips subviews selected

2 Auto Layout

[1] Show file inspector in the Xib file, select Use Auto layout

[2] adding constraints to controls

From the menu item Editor-->pin

Bottom right selection of Xib interface

[3] Common constraints, length and width

The distance from the four sides of the parent container

Aligns horizontally, vertically, relative to the parent container,

Relative to other controls, length, width equal, left, right, middle alignment, top, bottom, alignment, transverse interval, longitudinal interval

[4] Editing a constraint that modifies any of the current controls

Select the control directly, double-click and modify it, depending on the constraint line displayed in the panel

Select the control, view show the Size Inspector panel, display the current constraint, and modify

[5] Common interface setting size is 4.7 inch

iOS Interface layout Finishing

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.