猴年支付宝可算是给大家一个很好的惊喜,刺激。大家都在为敬业福而四处奔波。可是到最后也没有几个得到敬业福德,就像我。不知道大家有没有观察,五福界面的滚动是一个很好的设计。在这里,给大家带来简单的滚动实现,首先看一下实现效果。通过观察不难发现,有很多地方并不是那么容易想出来的,对于篇 ...
猴年支付宝可算是给大家一个很好的惊喜,刺激。大家都在为敬业福而四处奔波。可是到最后也没有几个得到敬业福德,就像我。不知道大家有没有观察,五福界面的滚动是一个很好的设计。在这里,给大家带来简单的滚动实现,首先看一下实现效果。
通过观察不难发现,有很多地方并不是那么容易想出来的,对于篇随笔,感兴趣可以查查相关资料,我就不尽行过多说明,(主要是开考文字,不好说明😄)。
献出代码,请收下。
//// ViewController.m// CX 支付宝-五福简单框架实现-线性滚动(UICollectionView)//// Created by ma c on 16/3/19.// Copyright © 2016年 xubaoaichiyu. All rights reserved.//#import "ViewController.h"#import "CXCollectionViewFlowLayout.h"static NSString * identifier = @"cxCellID";@interface ViewController ()<UICollectionViewDataSource>@property (nonatomic, strong) UICollectionView * collectionView;@end@implementation ViewController#pragma mark - set_and_get-(UICollectionView *)collectionView{ if (!_collectionView) { //自定义网格布局 CXCollectionViewFlowLayout * flowLayout = [[CXCollectionViewFlowLayout alloc]init]; _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, 300) collectionViewLayout:flowLayout]; _collectionView.dataSource = self; [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:identifier]; } return _collectionView; }#pragma mark - life- (void)viewDidLoad { [super viewDidLoad]; [self.view addSubview:self.collectionView]; }#pragma mark - deleDate-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return 30;}-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath]; cell.backgroundColor = [UIColor orangeColor]; return cell;}@end
原标题:IOS 支付宝-五福简单框架实现-线性滚动(UICollectionView)
关键词:IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。