3.小项目:摸我干啥!版本1.0

---------------  ViewController.m  --------------- 

#import "ViewController.h"


@interface ViewController ()

@property (weak, nonatomic) IBOutlet UIButton *head;

- (IBAction)topClick;

- (IBAction)bottomClick;

- (IBAction)leftClick;

- (IBAction)rightClick;

- (IBAction)leftRotateClick;

- (IBAction)rightRotateClick;

- (IBAction)minusClick;

- (IBAction)plusClick;

@end


@implementation ViewController

- (IBAction)topClick

{

    CGRect frame = self.head.frame;

    frame.origin.y -= 10;

    self.head.frame = frame;

}

- (IBAction)bottomClick

{

    CGRect frame = self.head.frame;

    frame.origin.y += 10;

    self.head.frame = frame;

}

- (IBAction)leftClick

{

    CGRect frame = self.head.frame;

    frame.origin.x -= 10;

    self.head.frame = frame;

}

- (IBAction)rightClick

{

    CGRect frame = self.head.frame;

    frame.origin.x += 10;

    self.head.frame = frame;

}

- (IBAction)leftRotateClick

{

    

    self.head.transform = CGAffineTransformRotate(self.head.transform, -M_PI_4);


}

- (IBAction)rightRotateClick

{

    self.head.transform = CGAffineTransformRotate(self.head.transform, M_PI_4);

}

- (IBAction)minusClick

{

    CGRect frame = self.head.frame;

    frame.size.width -= 10;

    frame.size.height -= 10;

    self.head.frame = frame;

}

- (IBAction)plusClick

{

    CGRect frame = self.head.frame;

    frame.size.width += 10;

    frame.size.height += 10;

    self.head.frame = frame;

}

@end 

posted @ 2015-07-28 17:20  我要选李白  阅读(135)  评论(0编辑  收藏  举报