IOS-UIButton/UIImageView/UISlider/UISwitch

Source: Internet
Author: User

  

1. CGRect frame

1> indicates the position and size of the control (with the upper left corner of the parent control as the coordinate origin (0, 0 ))

2> modify this property to adjust the widget's position and size.

 

2. CGPoint center

1> indicates the midpoint of the control (with the upper left corner of the parent control as the coordinate origin)

2> modify this property to adjust the widget location

 

3. CGRect bounds

1> indicates the position and size of the control (with the coordinates of the origin in the upper left corner of the control, the position is always (0, 0 ))

2> to modify this attribute, you can only adjust the widget size.

 

4. int tag

1> Control ID

2> different controls can be distinguished by different identifiers

 

5. CGAffineTransform transform

1> represents the control's deformation status (rotation angle, scaling ratio)

2> Create a CGAffineTransform Function

* *** [Self. view addSubview: subcontrol];

 

 

 

[Self. view addSubview: subcontrol];

 

3. Set button Properties

UIButton *btn =btn.frame = CGRectMake(, , , UIImage *normal = [UIImage imageNamed:[btn setTitle:UIImage *high = [UIImage imageNamed:[btn setTitle:[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];

 

 

1. This is a controller method.

2. When the Controller's view is created, it is called once.

 

 

1. The value attribute can get the current progress value.

2. If the value of the button changes, the UIControlEventValueChanged event is triggered.

 

 

1. When loading a plist file, a plist Root Node object (Root) will be returned)

 

 

1. Use NSBundle to access the content of a resource package

 

2. If you access the content of the most important resource package in the software, use mainBundle.

NSBundle * bundle = [NSBundle mainBundle];

 

3. Use NSBundle to obtain the full file path

NSString * path = [bundle pathForResource: @ "descs" ofType: @ "plist"];

 

                          

ViewController. h

  <UIKit/UIKit.h>   @property (weak, nonatomic) IBOutlet UIButton *   - (IBAction)reset:(   - (IBAction)run:(  - (IBAction)scale:(  - (IBAction)rotate:( 

 

ViewController. m

KDelta 50-() btnClickWithBlock :( (^ [UIView setAnimationDuration: mark control button (up and down)-(IBAction) run :( [self btnClickWithBlock: ^ CGPoint tempCenter = tag =: tempCenter. y-=: tempCenter. x + =: tempCenter. y + =: tempCenter. x-= _ btn. center = mark zoom in/out-(IBAction) scale :( [self btnClickWithBlock: ^ CGFloat scale = [sender tag] =?: _ Btn. transform = mark left rotation \ right rotation-(IBAction) rotate :( [self btnClickWithBlock: ^ tag = (= tag) {_ btn. transform = CGAffineTransformRotate (_ btn. transform, M_PI_4 *-} {_ btn. transform = CGAffineTransformRotate (_ btn. transform, M_PI_4 * mark reset-(IBAction) reset :( [self btnClickWithBlock: ^ _ btn. transform =

 

8. Examples and simple image browsers

 

 

ViewController. h

  <UIKit/UIKit.h>   - (IBAction)nightMode:(UISwitch * - (IBAction)imageSizeChange:(UISlider * - - (IBAction)sliderValueChange:(UISlider * @property (weak, nonatomic) IBOutlet UIImageView * @property (weak, nonatomic) IBOutlet UILabel * @property (weak, nonatomic) IBOutlet UILabel * @property (weak, nonatomic) IBOutlet UIView *  

ViewController. m

After the view of the NSArray * mark controller is loaded, it is called once (NSBundle * bundle = NSString * path = [bundle pathForResource: ofType: _ allDescs = _ imageDesc. text = _ allDescs [mark night mode-(IBAction) nightMode :( UISwitch * (sender. on) {self. view. backgroundColor =}{ self. view. backgroundColor = mark image size changed-(IBAction) imageSizeChange :( UISlider * _ imageView. transform = mark click Settings-[UIView setAnimationDuration: CGPoint tempCenter = (_ settingView. frame. origin. y = self. view. frame. size. height) {tempCenter. y-=} {tempCenter. y + = _ settingView. center = mark slider value change-(IBAction) sliderValueChange :( UISlider * NSString * imageName = [NSString stringWithFormat: _ imageView. image = _ imageNo. text = [NSString stringWithFormat:, sender. value + no = () (sender. value + _ imageDesc. text =

 

Thanks! Clear Saup

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.