测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布最新发布 | 2015年4月 |
由 btxkenshin 维护。
KSGallerySlidingCollectionView
是采用 UltraVisual 风格的集合视图菜单。
参考自 RPSlidingMenu,但我们进行了一些改进,使其成为一个高度可定制、轻量级的组件。
见 KSGallerySlidingCollectionViewDemo
(参见 /KSGallerySlidingCollectionViewDemo 中的示例 Xcode 项目)
创建一个继承自 KSGallerySlidingCell
的新文件。重写以下方法
- (void)layoutSubViewsWithPercent:(CGFloat)percentOfGrowth
您应该对所有位置和 alpha 变化进行所有处理,基于 percentOfGrowth 百分比
在 ViewController 中,设置 CollectionView
KSGallerySlidingLayout *layout = [[KSGallerySlidingLayout alloc] initWithDelegate:self];
layout.itemSize = CGSizeMake(CGRectGetWidth(self.collectionView.frame), HomeNewsCellCollapsedHeight);
self.collectionView.collectionViewLayout = layout;
[self.collectionView registerNib:[UINib nibWithNibName:@"HomeNewsCell" bundle:nil] forCellWithReuseIdentifier:@"HomeNewsCell"];
您可以自定义 featureHeight 和 collapsedHeight。
在初始化 cell 的高度后设置它
self.featureHeight = HomeNewsCellFeatureHeight;
self.collapsedHeight = HomeNewsCellCollapsedHeight;
在 ViewController 中实现 KSGallerySlidingLayoutLayoutDelegate
- (CGFloat)heightForFeatureCell
{
// return RPSlidingCellFeatureHeight;
return HomeNewsCellFeatureHeight;
}
- (CGFloat)heightForCollapsedCell
{
// return RPSlidingCellCollapsedHeight;
return HomeNewsCellCollapsedHeight;
}
自定义当视图滚动时的 cell 动画。您需要在您的 cell 中重写以下方法,并基于 percentOfGrowth 百分比进行所有位置和 alpha 变化处理
- (void)layoutSubViewsWithPercent:(CGFloat)percentOfGrowth
如果您有任何建议,请随时联系我。