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