Ios-ui Foundation-push Button expansion

Source: Internet
Author: User

State of the button

Default Normal/defaults state

Highlighted highlight status

If the button is clicked, it will automatically switch to the highlighted state.

Selected selected State

The button is selected by setting selected = YES

Disabled Disabled State

Disabled state by setting enabled = No, no response to any click events once disabled

How big the BackgroundImage button is, and how big the picture will appear

How big the image is, the button will be stretched to the size of the image

If tile backgroundimage is also set: text appears directly above the picture

If you set the title image at the same time : Picture on the left, text on the right

If you set the button's title, image, BackgroundImage, you must set the state of the

Coordinate system concepts

Frame : Is the coordinate origin of the control in the upper-left corner of the parent view

Bounds : Is the control with its own upper-left corner as the origin of the coordinates, general x = 0, y = 0

Center : is the control with the upper-left corner of the parent view as the coordinate Origin x, y

You cannot directly modify the member variables of the object's struct body

Copy and paste to get the control, you need to remove the previous connection

Use this method to define enumerations

typedef ns_enum (Nsinteger, zbdirection) {

Zbdirectionup,

Zbdirectiondown,

Zbdirectionleft,

Zbdirectionright

};

//**********************

Two modes of animation

1. End-to-end animations

Start animation

[UIView Beginanimations:nil Context:nil];

Action to perform animations

Duration duration

#warning will not take effect until the animation action code is executed

[UIView setanimationduration:0.5];

Self.zbButton.frame = Tempframe;

Submit Animation

[UIView commitanimations];

2. Block animation (focus on block animation)

[UIView animatewithduration:0.5 animations:^{

Place an action to perform an animation

Self.zbButton.frame = Tempframe;

}];

How the button is instantiated

Buttonwithtype:

Initwithframe:ui Control-Unique instantiation method

Init: An instantiation method for all objects

Set a background picture for a button

IImage *image = [UIImage imagenamed:@ "btn_01"];

[Button Setbackgroundimage:image Forstate:uicontrolstatenormal];

/**

Button: Buttons to add a listener method

Target: Monitor Listener

Action: The method to be executed by the listener when the button is clicked

forControlEvents: event that triggers a click

*/

[Button addtarget:self

Action: @selector (Didclickbutton:)

Forcontrolevents:uicontroleventtouchupinside];

Stroryboard: Hides a lot of detail

Pure code: can be very convenient to do the modification and debugging

Ios-ui Foundation-push Button expansion

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.