标签:
//
// ViewController.m
// MovePicture
//
// Created by YaguangZhu on 15/7/28.
// Copyright (c) 2015年 YaguangZhu. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
- (IBAction)up;
- (IBAction)down;
- (IBAction)left;
- (IBAction)right;
- (IBAction)big:(id)sender;
- (IBAction)small;
@property (weak, nonatomic) IBOutlet UIButton *btnIcon;
@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)up {
NSLog(@"up");
CGPoint originFrame = self.btnIcon.center;
originFrame.y =originFrame.y - 10;
NSLog(@"%f",originFrame.y);
//self.btnIcon.center=originFrame;
//[self.btnIcon setNeedsDisplay];
/*[UIView animateWithDuration:1.0 animations:{
self.btnIcon.frame = originFrame
}]*/
}
- (IBAction)down {
NSLog(@"down");
CGRect originFrame = self.btnIcon.frame;
originFrame.origin.y = originFrame.origin.y+10;
self.btnIcon.frame=originFrame;
}
- (IBAction)left {
NSLog(@"left");
CGRect originFrame = self.btnIcon.frame;
originFrame.origin.x = originFrame.origin.x-10;
self.btnIcon.frame=originFrame;
}
- (IBAction)right {
NSLog(@"right");
CGRect originFrame = self.btnIcon.frame;
originFrame.origin.x = originFrame.origin.x+10;
self.btnIcon.frame=originFrame;
}
- (IBAction)big:(id)sender {
NSLog(@"big");
CGRect originFrame = self.btnIcon.frame;
originFrame.size=CGSizeMake(originFrame.size.width+10, originFrame.size.height+10);
self.btnIcon.frame=originFrame;
}
- (IBAction)small {
}
@end
标签:
原文地址:http://www.cnblogs.com/zhuyaguang/p/4683014.html