登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

CKSlideView

[复制链接]
来自: 李世铿 分类: iOS精品源码 上传时间: 2016-5-17 14:26:27
Tag:Slide horizontal CKSlideView 水平 NYT horizontal

项目介绍:

CKSlideView
文:sunnysideprodcorp/Objective-C_CKSlideView

这款应用是受到了 iPad NYT Cooking App 的启发, 功能是照片在手指滑动的过程中会分开到重合的动画效果。 It's quite small, and is designed for cases where you will put all your content in a horizontal scroll view. Different looks depend on whether you have paging enabled and what kind of trajectory you assign to your moving views.

Two custom classes were written to create this functionality. First, CKSlideView itself hosts the scroll view, serves as the scroll view's delegate, and calls the movement functions for the CKMovingView subviews. CKMovingView is subclasses from UIImageView so that it can be used to display ordinary drawn content or image files.
(两个自定义的类实现了这个功能,CKSlideView控制了scroll view,为 scroll view 的代理提供服务,而且调用了移动方法控制CKMovingView的子类。CKMovingView是UIImageView的子类所以他可以显示普通的绘画内容或者图片文件)

Setup is quite easy. Create an instance of a subclass of CKSlideView, which you've cusotmized yourself with viewDidLoad to create and add the desired CKMovingViews to self.sv within CKSlideView:
(初始化方法非常简单。创建了一个子类继承
CKSlideView,然后在viewDidLoad方法中进行初始化)

[Objective-C] 查看源文件 复制代码
    CKSlideViewSubclass *sv = [[CKSlideViweSublcass alloc] init];
    sv.numPages = 6;
   


Then you can load this. I assume in your viewDidLoad for this CKSlideViewSubclass, you create the CKMovingViews you want, perhaps like so:
[Objective-C] 查看源文件 复制代码
   // within some loop for i = scroll view index, and j and k = layout loops
               CKMovingView * lilView = [[CKMovingView alloc] initWithFrame:CGRectMake(self.width * i + outerHorizontalMargin * ABS(k-1) + k*(self.width - boxWidth - outerHorizontalMargin), beginHeight+boxHeight*j, boxWidth, boxHeight)];

                // rotate to give an askew aesthetic
                CGAffineTransform transform = CGAffineTransformRotate(CGAffineTransformIdentity, pow(-1, j) * [self generateRandomNumberWithlowerBound:displayRotation - 3 upperBound:displayRotation + 4] * M_PI/180);
                lilView.transform = transform;


                // CKMovingView setup parameters to establish pattern of movement
                lilView.totalOffset = totalMovement;
                int moveAngle = [self generateRandomNumberWithlowerBound:MOVE_ANGLE - 3 upperBound:MOVE_ANGLE+3];
                lilView.moveAngle = pow(-1, j) * ABS(180 * ABS(k-1) - moveAngle);


               [self.sv addSubview:lilView];


               [views_i addObject:lilView];

...
       // outside of j, k loop
       // add array of views for a given scroll view 'page' index to self.viewsArray
       [self.viewsArray addObject: views_i];




DEMO下载:


相关源码推荐:

我来说两句
*滑动验证:
所有评论(21)
王颖博 2016-5-17 14:43:03
感谢分享,Code4App有你更精彩
回复
doudou-wwcd 2016-5-17 19:21:24
支持 有你更精彩
回复
初冬 2016-5-18 10:02:54
很给力,Code4App有你更精彩!
回复
夜空中点星 2016-5-18 11:18:20
虽不明,但觉厉!
回复
123123123wrerew 2016-5-19 08:35:59
学习学习!
回复
祝羲杰 2016-5-19 16:32:35
正需要啊,感谢楼主无私分享!
回复
0123456789ooooo 2016-5-26 10:48:30
强烈支持楼主ing……
回复
浣溪沙 2016-5-27 19:23:23
正需要啊,感谢楼主无私分享!
回复
颜路 2016-6-5 18:17:28

很给力,Code4App有你更精彩
回复
123下一页
提取码:  下载次数:18 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
1013 0 18
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

代码贡献英雄榜
用户名 下载数
通过邮件订阅最新 Code4App 信息
上一条 /4 下一条
联系我们
关闭
合作电话:
13802416937
Email:
435399051@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| 广东互联网违法和不良信息举报中心|中国互联网举报中心|Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

快速回复 返回顶部 返回列表