iOS uses code and storyboard, xib to set rounded corners for controls (for example, as a button)

Source: Internet
Author: User

Let's start by looking at how the code sets the rounded corners of the button:

Let's take a look at how to set a fillet for a button in storyboard or xib:

1. After adding a button in storyboard or Xib, set the title and background color, and make the constraint;

2. Click the Show the Identity Inspector button, and the button position is as follows:

3. Then add the Layer.cornerradius property to the button in the user Defined Runtime Attributes bar, type number, and set a value as required. As shown in the following:

4. The rounded corners of the buttons are basically completed here, please note! Because the runtime attribute is added to the control in the user Defined Runtime Attributes Bar, the button in the storyboard or xib is displayed in a square shape, such as:

Finally, please look at the use of code and storyboard for the button to set the fillet

iOS uses code and storyboard, xib to set rounded corners for controls (for example, as a button)

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.