Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

结合自己项目中的使用,对于JXCategoryView优化的一些小建议 #455

Open
JC-Sung opened this issue Jul 20, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@JC-Sung
Copy link

JC-Sung commented Jul 20, 2022

1,定义了JXCategoryLayoutMode,来控制title的显示方式,因为项目中要居中但又不能均分
// 以下布局均只在 item 个数较少的情况下生效,即无法滚动 MenuView 时.
typedef NS_ENUM(NSUInteger, JXCategoryLayoutMode) {
//等价于averageCellSpacingEnabled = YES,默认的布局模式, item 会均匀分布在屏幕上,呈分散状
JXCategoryLayoutModeScatter,
JXCategoryLayoutModeLeft, // Item 紧靠屏幕左侧
JXCategoryLayoutModeRight, // Item 紧靠屏幕右侧
JXCategoryLayoutModeCenter, // Item 紧挨且居中分布
};逻辑直接在418新增,只需重新计算下contentEdgeInsetLeft和contentEdgeInsetRight即可
2,JXCategoryTitleImageView中ImageView的扩展,我在项目中扩展成SDAnimatedImageView用来加载webp或者GIF使用就很方便
3,新增了- (UICollectionViewFlowLayout *)collectionViewContainerView:(JXPagerView *)listContainerView接口,自定义UICollectionViewFlowLayout,实现页面切换的视差效果以及各种切换动画
4,JXCategoryView的title好像不能多颜色哦,比如热卖的title是红色的SALE其他的是黑色,但目前的下划线是支持颜色数组的,我在项目中给JXCategoryView也增加了类似indicatorColors的属性用于给特定的title上色,还不能影响渐变效果
5,添加子控制器时少了一项步骤,应调用[(UIViewController *)list didMoveToParentViewController:self.containerVC];对应的也有移除的方法,这样就不用在loadView里面写self.view = [[UIView alloc] init];了
6,要想延续滚动(JXPagerSmoothView),那么列表上就不能有UITableViewStylePlain的那种悬浮的sectionheader,要想有这种悬浮的sectionheader,就不能延续滚动,这个目前看到的各类pageController貌似都不能达到完美的效果

@pujiaxin33
Copy link
Owner

非常感谢反馈,很好的建议,如果能提PR实现就更好了.

@pujiaxin33 pujiaxin33 added the enhancement New feature or request label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants