Files
peko-ios/YuMi/Modules/YMNewHome/View/PIHoemCategoryTitleView.m

73 lines
2.2 KiB
Mathematica
Raw Normal View History

2023-09-01 18:58:41 +08:00
//
// PIHoemCategoryTitleView.m
// YuMi
//
// Created by duoban on 2023/9/1.
//
#import "PIHoemCategoryTitleView.h"
2024-02-22 15:58:48 +08:00
#import "PIHoemCategoryTitleCell.h"
#import "PIHoemCategoryCollectionView.h"
@interface PIHoemCategoryTitleView()<PIHoemCategoryCollectionViewDelegate>
@property(nonatomic,strong) PIHoemCategoryCollectionView *pi_collectionView;
2023-09-01 18:58:41 +08:00
@end
@implementation PIHoemCategoryTitleView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
2024-02-22 15:58:48 +08:00
[self addSubview:self.pi_collectionView];
2023-09-01 18:58:41 +08:00
}
-(void)installConstraints{
2024-02-22 15:58:48 +08:00
[self.pi_collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
2023-09-01 18:58:41 +08:00
}];
}
2024-02-22 15:58:48 +08:00
-(void)setTitleList:(NSMutableArray *)titleList{
_titleList = titleList;
self.pi_collectionView.titleList = titleList;
}
2023-09-25 16:02:57 +08:00
- (void)setIndex:(NSInteger)index{
2023-09-01 18:58:41 +08:00
_index = index;
2024-02-22 15:58:48 +08:00
self.pi_collectionView.index = _index;
2023-09-01 18:58:41 +08:00
}
2024-02-22 15:58:48 +08:00
#pragma mark - PIHoemCategoryCollectionViewDelegate
- (void)pi_didSelectItemAtIndex:(NSInteger)index{
2024-02-22 15:58:48 +08:00
if(self.scrolledHandle){
self.scrolledHandle(index);
2023-09-01 18:58:41 +08:00
}
}
2024-02-22 15:58:48 +08:00
#pragma mark -
- (PIHoemCategoryCollectionView *)pi_collectionView{
if (!_pi_collectionView) {
_pi_collectionView = [[PIHoemCategoryCollectionView alloc] initWithFrame:CGRectZero ];
_pi_collectionView.delegate = self;
2023-09-01 18:58:41 +08:00
}
2024-02-22 15:58:48 +08:00
return _pi_collectionView;
2023-09-01 18:58:41 +08:00
}
//- (void)layoutSubviews{
// [super layoutSubviews];
//
// //使JXCategoryViewUICollectionView
// //JXCategoryView
//
// CGRect targetFrame = CGRectMake(0, 0, self.bounds.size.width - kGetScaleWidth(159), floor(self.bounds.size.height));
2024-02-22 15:58:48 +08:00
// self.pi_collectionView.frame = targetFrame;
2023-09-01 18:58:41 +08:00
//
//
//}
@end