读书人

【IOS范例小计】图像移动-可扩展为动态

发布时间: 2013-10-08 16:46:23 作者: rapoo

【IOS实例小计】图像移动--可扩展为动态实现图标变化

预备知识:

1.页面切换:

从一个ViewController切换到另一个ViewController有下面几种方法:

(1)self.view addSubview:(加载的新页面); 相应的 [self.view removeFromSuperview];可以回到起始页面(2)self.view insertSubview:(加载的新页面) atIndex:n;对n的解释:页面都是层次叠加的,n表示加载到那一层上面(3) self presentModalViewController:(加载的新页面) animated:2.UI动画移动原理:

定义一个起始位置和一个终止位置,使用CGPoint对象来代表,然后定义一个动画,最后提交这个动画,使之在应用运行的状态下实现动画效果。

3.代码:

//

// MoveViewController.h

// ImageView

//

// Created by zhang xujun on 13-9-9.

// Copyright (c) 2013年 zhang xujun. All rights reserved.

//


#import <UIKit/UIKit.h>


@interface MoveViewController :UIViewController


@property (strong,nonatomic)IBOutlet UIButton *returnSuperView;

@property (strong,nonatomic)IBOutlet UIButton *moveImage;

@property (strong,nonatomic)IBOutlet UIImageView *moveImageView;


-(IBAction)returnSuperViewButton:(id)sender;

-(IBAction)move:(id)sender;

@end



【IOS范例小计】图像移动-可扩展为动态实现图标变化




参考:

http://blog.sina.com.cn/s/blog_6700ebf201016ios.html

http://www.cnblogs.com/xingchen/archive/2011/08/15/2139771.html

读书人网 >操作系统

热点推荐