标签:
--------------- 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
标签:
原文地址:http://www.cnblogs.com/lixiang2015/p/4683515.html