测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布上次发布 | 2014 年 12 月 |
由 Kenny Tang 维护。
这是 Yahoo TimeTraveler 应用风格的卡片轮的哥伦比亚展览会布局子类的实现示例。
详情请参阅:http://corgitoergosum.net/?p=1296
MIT (https://github.com/kenshin03/RouletteWheelCollectionViewDemo/blob/master/LICENSE)
RVCollectionViewCell.h
和 RVCollectionViewLayout.h
。UICollectionView
实例,并使用 RVCollectionViewLayout.h
作为布局类。UICollectionViewDataSource
和 UICollectionViewDelegateFlowLayout
方法。demoViewController.m
#import "RVCollectionViewCell.h"
#import "RVCollectionViewLayout.h"
@interface RVViewController ()<UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
...
/* inits the layout object and sets it to your uicollectionview via setCollectionViewLayout: */
[self.collectionView registerClass:[RVCollectionViewCell class] forCellWithReuseIdentifier:@"ItemIdentifier"];
self.collectionViewLayout = [[RVCollectionViewLayout alloc] init];
self.collectionViewLayout.superView = self.view;
[self.collectionView setCollectionViewLayout:self.collectionViewLayout];
...
/* In cellForItemAtIndexPath:, return an instance of RVCollectionViewCell */
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
RVCollectionViewCell *cell = (RVCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"ItemIdentifier" forIndexPath:indexPath];
cell.imageView = self.imagesArray[indexPath.item];
return cell;
}
卡片图像是 DeviantArts 上的 yozzo 的作品 - http://yozzo.deviantart.com/