// ViewController.m
// spin
//
// Created by 袁跃 on 16/4/25.
// Copyright © 2016年 iflytek. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *btnButton;
- (IBAction)move:(id)sender;
- (IBAction)spin:(id)sender;
- (IBAction)scale:(id)sender;
- (IBAction)back:(id)sender;
- (IBAction)change:(id)sender;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically
from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)move:(id)sender {
self.btnButton.transform = CGAffineTransformTranslate(self.btnButton.transform, 0, 50);
}
- (IBAction)spin:(id)sender {
[UIView animateWithDuration:3 animations:^{
self.btnButton.transform = CGAffineTransformTranslate(self.btnButton.transform, 0, 50);
self.btnButton.transform = CGAffineTransformScale(self.btnButton.transform, 2, 2);
self.btnButton.transform = CGAffineTransformRotate(self.btnButton.transform, M_PI_4);
}];
}
- (IBAction)scale:(id)sender {
self.btnButton.transform = CGAffineTransformScale(self.btnButton.transform, 0.5, 0.5);
}
- (IBAction)back:(id)sender {
self.btnButton.transform = CGAffineTransformIdentity;
}
- (IBAction)change:(id)sender {
for (UIView* view
in self.view.subviews) {
view.backgroundColor = [UIColor redColor];
}
}
@end
网友评论