码迷,mamicode.com
首页 > 其他好文 > 详细

3.小项目:摸我干啥!

时间:2015-07-28 20:39:38      阅读:102      评论:0      收藏: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 

3.小项目:摸我干啥!

标签:

原文地址:http://www.cnblogs.com/lixiang2015/p/4683515.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!