码迷,mamicode.com
首页 > 移动开发 > 详细

ios-移动图片,放缩图片(按钮的使用)

时间:2015-07-28 17:27:41      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

//

//  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

 

ios-移动图片,放缩图片(按钮的使用)

标签:

原文地址:http://www.cnblogs.com/zhuyaguang/p/4683014.html

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