Lan Yi Education Record

Source: Internet
Author: User

There are two ways to customize a control: 1, pure code creation 2 through Xib custom controls

1. Xib Custom Controls (one xib can create multiple custom controls, but not generally)

1) First create a custom control class that inherits from the UIView Xib

    • Create a custom control class that inherits from UIView

    • Hold command and N to select empty in user interface to create a blank xib file

    • Change the file name to be the same as the class name, drag a page of the same type as the class, and associate the class file.

    • Change the size of the custom view: Select UIView to change size after size is set to freeform

    • Remove battery icon: Select View to change his status bar to None

    • Adding controls to Xib and associating controls to custom control classes

(Create attribute to. h file, associate event to. m file)

    • Working with custom controls in. m

2) Add Xib custom Controls

    • Associating a custom control class in a class that needs to add a custom control

#import "LoadingView.h"

    • To create a Xib custom control

    Loadingview *lv= [ [[NSBundle Mainbundle]loadnibnamed:@ "Loadingview" owner: Self Options:Nil]Lastobject];

(Here [[nsbundle mainbundle]loadnibnamed:@ "Loadingview" owner: self options:nil] returns an array, Because you can create multiple controls at the same time in a xib, they are added sequentially to the array, but generally not .

2. Create custom controls in plain text


Lan Yi Education Record

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.