"iOS development" about UIView summary and UIButton use

Source: Internet
Author: User

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

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.