iOS project development-custom control backgrounds and colors

Source: Internet
Author: User

In this part of the custom control, it may be more about the work of the artist than what the programmer should do. But the program does not understand the design of the ape is not a good siege lion. Program apes should also learn a little basic UI design, which will be more conducive to future learning and development.

Here I will take a button as an example to learn how to set the background image and color of this button. As we all know, the buttons in iOS are very concise, usually the blue text represents a button, and a rectangular color block in Android indicates that the button is different. But if you need to customize the background of the buttons in iOS because of the actual application, we can do so with a simple setup.

(1) First in the project to drag into two different colors of the background, one as the default state of the button, a button when clicked under the state of the button. The picture is placed in the images.xcassets.

(2) Drag a button in the interface and select default in the Right state Config, which means that the button is in normal condition and then select a background image in the background below.


(3) Then choose highlighted, this means that the highlight, that is, the button is being clicked on the state, and then select a background map.


(4) Run the program, the status of the button in normal state and click the following:



(5) Of course, you will also find that there is selected in State Config, which indicates the status of the display after being clicked; Disable indicates the state when it cannot be clicked. We can try it out separately.


Many other controls have settings that are the same as buttons, and can be customized. There are lots of interesting properties in the property inspector on the right, so you can play with them.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

iOS project development-custom control backgrounds and colors

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.