登录 立即注册
金钱:

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

10分钟集成iOS9任务切换等动画效果

[复制链接]
来自: 李世铿 分类: iOS精品源码 上传时间: 2016-5-25 12:27:27
Tag:动画 animation protocol minutes support animation

项目介绍:

1. ScrollView 滚动时每个View都可以应用动画效果
1.gif
2. 使用这个库可以10分钟集成iOS9任务切换等动画效果
2.gif

3. 钢琴效果同样也可以很简单就集成。
3.gif

4. 垂直滑动效果
4.gif


Usage
Create the scroll view by:
[Objective-C] 查看源文件 复制代码
self.scrollView = [[LTInfiniteScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 200)];
[self.view addSubview:self.scrollView];
self.scrollView.dataSource = self;
[self.scrollView reloadDataWithInitialIndex: 0];



Sample code:
[Objective-C] 查看源文件 复制代码
- (NSInteger)numberOfViews
{
    // you can set it to a very big number to mimic the infinite behavior, no performance issue here
    return 9999; 
}

- (NSInteger)numberOfVisibleViews
{
    return 5;
}

- (UIView *)viewAtIndex:(NSInteger)index reusingView:(UIView *)view;
{
    if (view) {
        ((UILabel *)view).text = [NSString stringWithFormat:@"%ld", index];
        return view;
    }

    UILabel *aView = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 64, 64)];
    aView.backgroundColor = [UIColor blackColor];
    aView.layer.cornerRadius = 32;
    aView.layer.masksToBounds = YES;
    aView.backgroundColor = [UIColor colorWithRed:0/255.0 green:175/255.0 blue:240/255.0 alpha:1];
    aView.textColor = [UIColor whiteColor];
    aView.textAlignment = NSTextAlignmentCenter;
    aView.text = [NSString stringWithFormat:@"%ld", index];
    return aView;
}





LTInfiniteScrollView interface:
[Objective-C] 查看源文件 复制代码
@interface LTInfiniteScrollView: UIView
@property (nonatomic, readonly) NSInteger currentIndex;
@property (nonatomic, weak) id<LTInfiniteScrollViewDataSource> dataSource;
@property (nonatomic, weak) id<LTInfiniteScrollViewDelegate> delegate;
@property (nonatomic) BOOL verticalScroll;
@property (nonatomic) BOOL scrollEnabled;
@property (nonatomic) BOOL pagingEnabled;
@property (nonatomic) BOOL bounces;
@property (nonatomic) UIEdgeInsets contentInset;
@property (nonatomic) NSInteger maxScrollDistance;

- (void)reloadDataWithInitialIndex:(NSInteger)initialIndex;
- (void)scrollToIndex:(NSInteger)index animated:(BOOL)animated;
- (UIView *)viewAtIndex:(NSInteger)index;
- (NSArray *)allViews;
@end





If you want to apply any animation during scrolling, implement LTInfiniteScrollViewDelegate protocol:
[Objective-C] 查看源文件 复制代码
@protocol LTInfiniteScrollViewDelegate<NSObject>
- (void)updateView:(UIView *)view withProgress:(CGFloat)progress scrollDirection:(ScrollDirection)direction;
@end




The value of progress indicates the relative position of that view, if there are 5 visible views, the value will be ranged from -2 to 2:
1.png


DEMO下载:


相关源码推荐:

我来说两句
*滑动验证:
所有评论(68)
ogqs0493 2016-5-25 13:50:25
强烈支持楼主ing……
回复
18693891@qq.com 2016-5-25 14:16:31
淡定,淡定,淡定……
回复
ekko 2016-5-25 14:49:44
强烈支持楼主ing……
回复
q18836617 2016-5-25 15:45:07
有点贵啊
回复
hwp 2016-5-25 19:11:59
正需要啊,感谢楼主无私分享!
回复
xuxuxu321ple 2016-5-25 19:48:54
楼主威武啊,Code4App有你更给力!
回复
喵哥 2016-5-26 09:12:55
66666精华内容,楼主V5!
回复
0123456789ooooo 2016-5-26 09:46:53
感谢分享,Code4App有你更精彩
回复
0123456789ooooo 2016-5-26 09:51:39
学习学习!
回复
提取码:  下载次数:83 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
2923 2 83
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

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

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

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