Uikit-uibutton button operation

Source: Internet
Author: User

UIButton button operation
/ * UIVIew Common Properties 1.frame position and dimensions (in the upper left corner of the parent control as the origin (0,0)) 2.center midpoint (the origin (0,0) in the upper-left corner of the parent control) 3.bounds position and size (the origin (0,0) in its upper left corner) 4.tra Nsform Deformation properties (scale, rotate) 5.backgroundColor background color 6.tag identification (the parent control can find the corresponding child control based on this identity, not the same as a child control in the same parent control) 7. Hidden set whether to hide 8.alpha transparency (0~1); 9.opaque opacity (0~1); 10.userInteractionEnabled can interact with users (YES can interact) 11.superView parent control 12.subviews child controls 13.contentMode content display Pattern Stretch adaptive * ///required to change size and rotation using UIView frame, transform property#import "ViewController.h"  @interface viewcontroller ()- (ibaction) moveandbig;-(ibaction) Move: (UIButton*) btn;-(ibaction) big;-(ibaction) small;-(ibaction) leftrotate;-(ibaction) up;-(ibaction) Large;//Avatar@property(nonatomic,Weak)Iboutlet UIButton* HEAD;@end @implementation viewcontroller //Use animations to achieve edge-moving edge amplification- (ibaction) moveandbig{//1. Turning on animations[UIViewBeginanimations:NilContextNil]; [UIViewSetanimationduration:2.0];//time interval    //2. Modifying Properties    CGRectTempf = Self. Head. Frame; Tempf. Origin. x+= -; Tempf. Origin. Y+= -; Tempf. Size. Width+= -; Tempf. Size. Height+= -; Self. Head. Frame=tempf;//3. Submitting Animations[UIViewCommitanimations];}#pragma mark Move (up or down)- (ibaction) Move: (UIButton*) btn{//1. Remove the original attribute    CGRecttempf= Self. Head. Frame;//2. Modifying temporary properties    CGFloatDelta=Ten;Switch(BTN. Tag) { Case Ten://OnTempf. Origin. Y-=delta; Break; Case  -://DownTempf. Origin. Y+=delta; Break; Case  -://LeftTempf. Origin. x-=delta; Break; Case  +://RightTempf. Origin. x+=delta; Break; }//3. Re-assigning values     Self. Head. Frame=tempf;}#pragma mark Zoom in- (ibaction) big{//1. Remove the original attribute    CGRectTempframe = Self. Head. Frame;//2. Change temporary propertiesTempframe. Size. Width+= -; Tempframe. Size. Height+= -;//3. Overwrite the original property with temporary properties     Self. Head. Frame= Tempframe;}#pragma mark shrinks- (ibaction) small{//1. Remove the original attribute    CGRectTempframe = Self. Head. Frame;//2. Change temporary propertiesTempframe. Size. Width-= -; Tempframe. Size. Height-= -;//3. Overwrite the original property with temporary properties     Self. Head. Frame= Tempframe;}#pragma mark Transfor property, can (rotate, change position, size)- (ibaction) leftrotate{//Get button Image    UIButton* head = (UIButton*)[ Self. ViewViewwithtag: -]; Head. Transform=cgaffinetransformrotate (head. Transform,-m_pi_4);} - (ibaction) up{//Get button Image    UIButton* head = (UIButton*)[ Self. ViewViewwithtag: -]; Head. Transform=cgaffinetransformtranslate (head. Transform,0,-Ten);} - (ibaction) large{//Get button Image    UIButton* head = (UIButton*)[ Self. ViewViewwithtag: -]; Head. Transform=cgaffinetransformscale (head. Transform,1.5,1.5);}@end

Uikit-uibutton button operation

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.