当前位置: 首页 > news >正文

宁波哪里可以做网站企业网站源码哪个好

宁波哪里可以做网站,企业网站源码哪个好,网站管理系统安装,3a公司网络营销方案效果图 实现逻辑和原理 就是在 didEndDisplayingCell 方法中通过indexPathsForVisibleItems 接口获取当前可见的cell对应的indexPath#xff0c; 然后获取到item最小的那一个#xff0c;即可#xff0c;同时#xff0c;还要在 willDisplayCell 方法中直接设置标题的选中属…效果图 实现逻辑和原理 就是在 didEndDisplayingCell 方法中通过indexPathsForVisibleItems 接口获取当前可见的cell对应的indexPath 然后获取到item最小的那一个即可同时还要在 willDisplayCell 方法中直接设置标题的选中属性否则 由于重用机制导致选中的展示错乱 代码 // // LBLinkedContentView.m // LBTwoLinkedScrollingCollectionView // // Created by mac on 2024/6/25. //#import LBLinkedContentView.h #import LBLinkedContentViewTittleCell.h #import LBLinkedContentViewContentCell.hinterface LBLinkedContentView () UICollectionViewDelegate, UICollectionViewDataSourceproperty (nonatomic, strong) UICollectionView *titleView; property (nonatomic, strong) UICollectionView *contentView;property (nonatomic, strong) NSMutableArray *titleArray; property (nonatomic, strong) NSMutableArray *contentArray;property (nonatomic, strong) NSIndexPath *selectedGroupIndex;endimplementation LBLinkedContentView- (instancetype)initWithFrame:(CGRect)frame {if (self [super initWithFrame:frame]) {[self configData];[self setUpUI];}return self; }- (void)setUpUI {[self addSubview:self.titleView];[self addSubview:self.contentView];[self.titleView reloadData];[self.contentView reloadData];self.selectedGroupIndex [NSIndexPath indexPathForRow:0 inSection:0];LBLinkedContentViewTittleCell *titleCell [self.titleView cellForItemAtIndexPath:self.selectedGroupIndex];titleCell.selected YES; }#pragma mark - configData- (void)configData {for (int i 0; i 10; i ) {NSString *title [NSString stringWithFormat:%d,i];[self.titleArray addObject:title];NSMutableArray *array [NSMutableArray array];for (int j 0; j 10; j ) {NSString *content [NSString stringWithFormat:第%d分区第%d条, i,j];[array addObject:content];}[self.contentArray addObject:array];} }#pragma mark - data Delegate- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {if (collectionView self.contentView) {LBLinkedContentViewContentCell *cell [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([LBLinkedContentViewContentCell class]) forIndexPath:indexPath];NSString *title self.contentArray[indexPath.section][indexPath.item];[cell updateWithContent:title];return cell;}LBLinkedContentViewTittleCell *cell [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([LBLinkedContentViewTittleCell class]) forIndexPath:indexPath];[cell updateWithIndexPath:indexPath];return cell; }- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {if (collectionView self.titleView) {return 1;}return self.contentArray.count; }- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {return 10; }- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {if (collectionView self.titleView) {if (self.selectedGroupIndex [self.selectedGroupIndex compare:indexPath] NSOrderedSame) {cell.selected YES;} else {cell.selected NO;}} }- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {if (collectionView self.contentView) {[self handleGroupViewWithIndex:nil];} }#pragma mark - private- (void)handleGroupViewWithIndex:(NSIndexPath *)indexPathCell {NSArray NSIndexPath * *visibleIndexPaths [self.contentView indexPathsForVisibleItems];if (!visibleIndexPaths.count) {return;}NSInteger section indexPathCell ? indexPathCell.section : [self.contentView numberOfSections] - 1;for (NSIndexPath *indexPath in visibleIndexPaths) {if (indexPath.section section) {section indexPath.section;}}NSIndexPath *groupIndexPath [NSIndexPath indexPathForItem:section inSection:0];if(self.selectedGroupIndex [self.selectedGroupIndex compare:groupIndexPath] ! NSOrderedSame) {LBLinkedContentViewTittleCell *cell [self.titleView cellForItemAtIndexPath:self.selectedGroupIndex];cell.selected NO;self.selectedGroupIndex groupIndexPath;LBLinkedContentViewTittleCell *titleCell [self.titleView cellForItemAtIndexPath:groupIndexPath];titleCell.selected YES;[self.titleView scrollToItemAtIndexPath:groupIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:YES];} }#pragma mark - lazy load- (UICollectionView *)titleView {if (!_titleView) {UICollectionViewFlowLayout *layout [[UICollectionViewFlowLayout alloc] init];layout.minimumLineSpacing 29;layout.minimumInteritemSpacing 29;layout.scrollDirection UICollectionViewScrollDirectionHorizontal;layout.itemSize CGSizeMake(40, 50);_titleView [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), 60) collectionViewLayout:layout];[_titleView registerClass:[LBLinkedContentViewTittleCell class] forCellWithReuseIdentifier:NSStringFromClass([LBLinkedContentViewTittleCell class])];_titleView.delegate self;_titleView.dataSource self;}return _titleView; }- (UICollectionView *)contentView {if (!_contentView) {UICollectionViewFlowLayout *layout [[UICollectionViewFlowLayout alloc] init];layout.minimumLineSpacing 10;layout.minimumInteritemSpacing 10;layout.itemSize CGSizeMake(100, 80);layout.scrollDirection UICollectionViewScrollDirectionHorizontal;layout.sectionInset UIEdgeInsetsMake(0, 40, 0, 40);_contentView [[UICollectionView alloc] initWithFrame:CGRectMake(0, 80, CGRectGetWidth(self.bounds), 80) collectionViewLayout:layout];[_contentView registerClass:[LBLinkedContentViewContentCell class] forCellWithReuseIdentifier:NSStringFromClass([LBLinkedContentViewContentCell class])];_contentView.delegate self;_contentView.dataSource self;_contentView.backgroundColor [UIColor yellowColor];}return _contentView; }- (NSMutableArray *)titleArray {if (!_titleArray) {_titleArray [NSMutableArray array];}return _titleArray; }- (NSMutableArray *)contentArray {if (!_contentArray) {_contentArray [NSMutableArray array];}return _contentArray; }end link
http://www.zqtcl.cn/news/615893/

相关文章:

  • 网站每天点击量多少好精选聊城做网站的公司
  • 网站建设课程基础兰州网站seo费用
  • 天助可以搜索别人网站曲靖网站推广
  • 易语言编程可以做网站么网站备案流程
  • 我想接加工单seo搜索引擎优化工资
  • 西宁做网站君博推荐wordpress如何管理
  • 个人建一个网站多少钱怎样优化网络速度
  • 网站建设项目进度表长春百度seo代理
  • 购物网站排名哪家好免费做房产网站
  • 手机免费建设网站制作南通网站建设排名公司哪家好
  • 做商城网站哪里买企业官网招聘
  • 网站自己做流量互联网营销培训平台
  • 如何查看网站备案官方网站建设状况
  • 做什麽网站有前景软件 开发 公司
  • 淘宝做短视频网站好建设银行代发工资网站
  • 北京建商城网站网站做指向是什么意思
  • 定制网站开发介绍图移动网站适配
  • 青海网站建设怎么建设腾云建站官网
  • 怎样自己做企业的网站gif制作软件app
  • 阿里云建站后台网站建设多少钱合适
  • 自媒体图片素材网站景区网站怎么做的
  • 模块化网站建设江宁做网站
  • 电视网站后台管理系统漏洞淘客推广怎么做
  • 网站建设基础大纲文案丽江网站建设 莱芜
  • 程序员找工作的网站怎么给搞笑网站做文案
  • 网站flsh怎么做能被百度收录的建站网站
  • 娄底网站seo建平台网站费用
  • seo优化网站的注意事项WordPress伪静态公告404
  • 手机网站自动适应沈阳网站建设公司电话
  • 备案号网站下边苏州广告公司招聘