手机
当前位置:查字典教程网 >编程开发 >IOS开发 >iOS图片界面翻页切换效果
iOS图片界面翻页切换效果
摘要:先看效果:下面贴代码:#import"ViewController.h"@interfaceViewController()@propert...

先看效果:

iOS图片界面翻页切换效果1

下面贴代码:

#import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *backgroundView; @property (strong,nonatomic) NSArray *array; @end @implementation ViewController -(NSArray *)array { if (_array == nil) { UIImage *image1 = [UIImage imageNamed:@"01.jpg"]; UIImage *image2 = [UIImage imageNamed:@"02.jpg"]; _array = @[image1,image2]; } return _array; } - (void)viewDidLoad { [super viewDidLoad]; self.backgroundView.image = self.array[0]; // Do any additional setup after loading the view, typically from a nib. } -(void)changeImage { if (self.backgroundView.image == self.array[0]) { self.backgroundView.image = self.array[1]; }else { self.backgroundView.image = self.array[0]; } } - (IBAction)pushClick:(id)sender { [self changeImage]; CATransition *transtion = [[CATransition alloc] init]; transtion.type = @"push"; transtion.subtype = kCATransitionFromBottom; transtion.startProgress = 0.5; transtion.endProgress = 0.8; [self.view.layer addAnimation:transtion forKey:nil]; } /* 效果有好多种,上面代码只贴出了其中一种,如果需要其他效果,只需要将 transtion.type = @"push";中的type改一下就行。 比如: transtion.type = @"fade"; type的类型还有以下几种: fade,reveal,moveIn,cube,suckEffect,oglFlip,rippleEffect,pageCurl,pageCurl,cameraIrisHollowOpen,cameraIrisHollowClose,pageUnCurl,pageCurl,pageCurl,pageCurl */ - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持查字典教程网。

【iOS图片界面翻页切换效果】相关文章:

iOS开发之视图切换

iOS实现侧滑栏效果

Unity iOS混合开发界面切换思路解析

iOS点击文字按钮变转圈加载效果

iOS 引导页的镂空效果实例

iOS实现知乎和途家导航栏渐变的文字动画效果

iOS图片模糊效果的实现方法

iOS系统Crash文件分析方法

iOS抽屉效果开发案例分享

IOS实现点击滑动抽屉效果

精品推荐
分类导航