IOS CATransition 立体动画效果
来源:互联网 发布:网络投放 编辑:程序博客网 时间:2024/05/17 18:46
感受一下,效果很酷炫
#import "ViewController.h"
@interface ViewController (){
NSArray *array;//图片数组
NSInteger _index;//数组下标
}
@property (nonatomic,strong)UIImageView *image;
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
_index =0;
self.view.backgroundColor = [UIColorwhiteColor];
for (int i =0; i < 2; i ++) {
UIButton *button = [UIButtonbuttonWithType:UIButtonTypeCustom];
button.frame =CGRectMake(50 + i *160, 400,60, 40);
button.tag =300 + i;
button.backgroundColor = [UIColororangeColor];
[button addTarget:selfaction:@selector(action_button:)forControlEvents:UIControlEventTouchUpInside];
[self.viewaddSubview:button];
}
array =@[@"1.jpg",@"2.jpg",@"3.jpg",@"4.jpg"];
_image = [[UIImageViewalloc]initWithFrame:CGRectMake(10,120, 375 - 20,200)];
_image.image = [UIImageimageNamed:array[0]];
[self.viewaddSubview:_image];
}
- (void)action_button:(UIButton *)sender{
switch (sender.tag) {
case300:{
/*
TYPE 的类型
pageCurl 向上翻一页
pageUnCurl 向下翻一页
rippleEffect 滴水效果
suckEffect 收缩效果,如一块布被抽走
cube 立方体效果
oglFlip 上下翻转效果
*/
if (_index >0) {
_index --;
}else{
_index =array.count -1;
}
_image.image = [UIImageimageNamed:array[_index]];
CATransition *animation = [CATransitionanimation];
animation.type =@"oglFlip";
animation.subtype =kCATransitionFromLeft;
animation.duration =1.0f;
[_image.layeraddAnimation:animation forKey:@""];
}break;
case301:{
if (_index <array.count -1) {
_index ++;
}else{
_index =0;
}
_image.image = [UIImageimageNamed:array[_index]];
CATransition *animation = [CATransitionanimation];
animation.type =@"cube";
animation.subtype =kCATransitionFromRight;
animation.duration =1.0f;
[_image.layeraddAnimation:animation forKey:@""];
}break;
default:
break;
}
}
@end
- IOS CATransition 立体动画效果
- iOS动画效果 CATransition
- ios 动画效果CATransition笔记
- ios 动画效果CATransition笔记
- iOS动画 CATransition动画
- ios-day18-12(使用CATransition实现转场动画效果)
- ios开发视图切换效果动画类CATransition
- iOS 动画总结--CATransition
- iOS动画浅析-CATransition
- iOS CATransition动画Demo
- iOS CATransition动画
- iOS动画浅析-CATransition
- iOS切换动画CATransition
- iOS转场动画CATransition
- CATransition转场动画-IOS开发
- 【iOS开发】---- 转场动画 CATransition
- 【iOS开发】---- 转场动画 CATransition
- iOS 核心动画之CATransition
- LeetCode 95. Unique Binary Search Trees II
- 1018: 说反话
- python基本语法(二)
- JS中值类型与引用类型分析
- UVA - 575 Skew Binary
- IOS CATransition 立体动画效果
- UVA - 10110 Light, more light
- tjut 2855
- 深度学习方法(六):神经网络weight参数怎么初始化
- java中重写方法应遵循规则
- Android 悬浮窗实现
- ZZULI-oj -1905 小火山的跳子游戏 (GCD)
- 小火山的跳子游戏
- 数据链路层-3 ARP