There are a lot of buttons in a uivew, how do you tell them apart? It turns out that each control has a tag property
UIButton also has a tag property that can be distinguished by setting each button as a different attribute.
<span style= "color: #cc33cc;" >nsinteger tag = button.tag;</span>
gets the tag value of the button.
--------------------------------------------------------------------------------------------------
How do I make the button move?
5.f Rame\center\bounds
1 > Frame: ability to modify position and size
2 > Center: can modify the location
3 > Bounds: can modify the size (x\y are generally 0)
4 > Transform: can modify position/size/rotation angle
Because the control's X and Y values cannot be directly modified,
The frame or center property of the button is changed, and the position of the button can be changed when the value is assigned back.
cgrect rect =self. Head . Frame ;
Frame is a cgrect structure.
Change the value of the RECT and assign the rect to the frame.
self. Head . Frame = rect;
Zoom out is the same thing
--------------------------------------------------------------------------
the animation of the moving process is simple to implement.
[UIViewbeginanimations: Nil Context:nil];
[UIViewsetanimationduration:1];
Move or enlarge
[UIViewcommitanimations];
------------------------------------------------------
@Property (nonatomic,readonly) UIView *superview;
get your own parent control object
@Property (nonatomic,readonly,copy) Nsarray *subviews;
get all of your child control objects
@Property (nonatomic)nsinteger tag; //Each control will have a tag property.
The id\ ID of the control that the parent control can use to locate the corresponding child control
@Property (nonatomic)cgaffinetransform transform;
the deformation properties of the control (you can set the rotation angle, scale, pan, and other properties)
Common methods of UIView.
- (void) Addsubview: (UIView*) view; Add a child control view
- (void) Removefromsuperview; Remove from parent control-(UIView*) Viewwithtag: (Nsinteger) tag; find the corresponding control (usually child controls) based on a tag ID
"iOS development" about UIView summary and UIButton use