Ios-xib AutoLayout Add Constraint

Source: Internet
Author: User

Xib--autolayout add constraint Imitation QQ Login interface: Description: The following image background red is only convenient to see clearly; 1. Create a project: Create a XIB file 2. Open the XIB file: (1). Create Avatar: Drag control: uiimageview--"put anywhere-" Click the Align key, pin key, such as: At this time: can be arbitrarily constrained to control: Description: Because of time, not introduced to slowly self-pondering; Align key: horizontally: Vertical center alignment; vertically: horizontally centered on it; Pin key: Add New Constraints: Indicates the distance between the top and bottom of the control, constrain to margins: the location of the AutoMargins as a starting point to constrain, generally selected; width: is the height of the control; Note: The spacing between the upper and lower left and the width of the control, with the height of the use, try not to conflict; For example: 375 of the screen width, you can not distance to the left 200, the distance to the right 200, but also the width of the control 100, certainly not; The author suggested that: give the distance to the left, while giving Apply to Lable,textfile and other controls, regardless of how much it is to the right distance, if the distance between the left and right, do not give width, for the button and other controls; The following: The constraint to start adding ImageView: 1. Vertical center: Click on align-- Select horizontally--Click Add 1 constraint:2. Give size: 130 * 130, distance up edge 20; note: to the upper and lower left and right size: first click on the red dashed section, let him become a solid line, give width, height, tick check, then give size ; Last click: Add 3 constraint:3. Click Resolve Auto Layout issues--click on Update frames;4. Other processing: You can add a picture to the right, modify the background and other properties Run: 5 and 6s: change to rounded corners: Click on the top right corner: Two laps of the--"in. m files create attribute associations; Associations: Check Controls (Uiimageview)-right: Select the small circle behind the new prferencing outlet and drag it to the. m file @ Interface and @end: Name the attribute qqimg, and click Connect to associate: Last Modify Corner:

_qqimg.layer.cornerradius = 65;

Run:

Final: 6s and 5:

Ios-xib AutoLayout Add Constraint

Related Article

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.