--------------- viewcontroller.m ---------------
#import "ViewController.h"
@interface viewcontroller ()
@property (weak, nonatomic) iboutlet UIButton *head;
-(ibaction) Moveclick: (UIButton *) sender;
-(ibaction) Rotateclick: (UIButton *) sender;
-(ibaction) Sizechangeclick: (UIButton *) sender;
@end
@implementation Viewcontroller
-(ibaction) Moveclick: (UIButton *) sender
{
CGRect frame = self. head. frame;
Switch (sender.) tag)
{
Case 1:
Frame. Origin. y -= ten;
break;
Case 2:
Frame. Origin. x + = ten;
break;
Case 3:
Frame. Origin. y + = ten;
break;
Case 4:
Frame. Origin. x -= ten;
break;
default:
break;
}
Self. head. frame = frame;
}
-(ibaction) Rotateclick: (UIButton *) sender
{
Switch (sender.) tag) {
case 5 :
self . head . transform = cgaffinetransformrotate ( self . head . transform ,-m_pi_4 );
break;
Case 6:
self . head . transform = cgaffinetransformrotate ( self . head . transform , m_pi_4 );
default:
break;
}
}
-(ibaction) Sizechangeclick: (UIButton *) sender
{
CGRect frame = self. head. frame;
Switch (sender.) tag) {
Case 7:
Frame. size. width + = ten;
Frame. size. height + = ten;
break;
Case 8:
Frame. size. width = ten;
Frame. size. height = ten;
break;
default:
break;
}
Self. head. frame = frame;
}
@end
4. Small item: Touch What I do! (method Merge)