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

上传网站程序后又怎么做网络营销策划的内容

上传网站程序后又怎么做,网络营销策划的内容,网站建设与维护流程图,网上商城小程序开发首先看效果图 实现的思路,支持配置代理,通过代理方式设置 每个item的frame,支持设置头部的size, 支持多个分区,之前做过类似的,但是只支持一个分区, 后来遇到过几次多分区的,都是将一个collec…

首先看效果图
在这里插入图片描述

实现的思路,支持配置代理,通过代理方式设置
每个item的frame,支持设置头部的size,
支持多个分区,之前做过类似的,但是只支持一个分区,
后来遇到过几次多分区的,都是将一个collectionView放到tableViewCell 中实现的,这次为了使layout更强大,支持了多
个分区的,思路就是我们在prepare layout 获取到
分区数量和每个分区cell数量
,然后创建对应的布局属性,添加到一个总的数组中
然后在系统方法中返回整个数组即可

//
//  LBMutilMutilAutoWidthLayout.m
//  TEXT
//
//  Created by mac on 2025/3/30.
//#import "LBMutilMutilAutoWidthLayout.h"@interface LBMutilMutilAutoWidthLayout ()@property (nonatomic, strong) NSMutableArray<UICollectionViewLayoutAttributes *> *layoutAttributesArray;@property (nonatomic, assign) CGSize contentSize;@end@implementation LBMutilMutilAutoWidthLayout- (instancetype)init {if (self = [super init]) {self.layoutAttributesArray = [NSMutableArray new];}return self;
}- (void)prepareLayout {[super prepareLayout];[self updateLayout];
}- (CGSize)collectionViewContentSize {return self.contentSize;
}- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {return self.layoutAttributesArray;
}#pragma mark - ---------- update ----------- (void)updateLayout {// 移除旧的布局[self.layoutAttributesArray removeAllObjects];CGFloat currentY = 0;CGFloat x = self.sectionInset.left;// 计算新的布局NSInteger sectionCount = [self.collectionView numberOfSections];for (int i = 0; i < sectionCount; i ++) {CGSize headerSize = CGSizeZero;if (self.delegate && [self.delegate respondsToSelector:@selector(sizeForHeaderViewAtSection:)]) {headerSize = [self.delegate sizeForHeaderViewAtSection:i];}if (!CGSizeEqualToSize(headerSize, CGSizeZero)) {UICollectionViewLayoutAttributes *layoutAttributes = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader withIndexPath:[NSIndexPath indexPathForItem:0 inSection:i]];;layoutAttributes.frame = CGRectMake(0, currentY, headerSize.width, headerSize.height);currentY += headerSize.height;[self.layoutAttributesArray addObject:layoutAttributes];}NSInteger count = 0;if ([self.collectionView.dataSource respondsToSelector:@selector(collectionView:numberOfItemsInSection:)]) {count = [self.collectionView.dataSource collectionView:self.collectionView numberOfItemsInSection:0];}CGFloat currentX = x;if (count > 0) {for (int j = 0; j < count; j++) {CGSize cellSize = [self sizeForItemAtIndexPath:[NSIndexPath indexPathForItem:j inSection:i]];CGFloat cellWidth = cellSize.width;CGFloat cellHeight = cellSize.height;// 创建布局属性UICollectionViewLayoutAttributes *layoutAttributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:[NSIndexPath indexPathForItem:j inSection:i]];layoutAttributes.frame = CGRectMake(currentX, currentY, cellWidth, cellHeight);[self.layoutAttributesArray addObject:layoutAttributes];currentX += (self.minimumInteritemSpacing + cellWidth);// 计算下一个item的x,以及布局更新结束检测if (j != count - 1) {if (currentX + cellWidth + self.minimumInteritemSpacing + self.sectionInset.right > self.contentWidth) {currentX = self.sectionInset.left;currentY += self.minimumLineSpacing + cellHeight;}} else {currentY += cellHeight;}if (i == sectionCount - 1 && j == count - 1) {self.contentSize = CGSizeMake(self.contentWidth, currentY);}}}}
}- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)index {CGSize size = CGSizeZero;if ([self.delegate respondsToSelector:@selector(sizeForItemAtIndexPath:)]) {size = [self.delegate sizeForItemAtIndexPath:index];}return size;
}@end

用法

//
//  LBMutilSecionAutoLayoutViewController.m
//  TEXT
//
//  Created by mac on 2025/3/30.
//#import "LBMutilSecionAutoLayoutViewController.h"
#import "LBMutilMutilAutoWidthLayout.h"@interface LBMutilSecionAutoLayoutViewController () <LBMutilMutilAutoWidthLayouttDelegate,
UICollectionViewDelegate,
UICollectionViewDataSource>@property (nonatomic, strong) UICollectionView *collectionView;@end@implementation LBMutilSecionAutoLayoutViewController- (void)viewDidLoad {[super viewDidLoad];[self.view addSubview:self.collectionView];// Do any additional setup after loading the view.
}#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"22" forIndexPath:indexPath];cell.contentView.backgroundColor = [UIColor cyanColor];return cell;
}- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{UICollectionReusableView *header = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"header" forIndexPath:indexPath];return header;
}- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{return 3;
}- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{return 10;
}
#pragma mark - LBMutilMutilAutoWidthLayouttDelegate- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{CGFloat width;if (indexPath.section == 0) {width = 100;if (indexPath.item %2 == 0) {width = 50;}} else {width = 70;if (indexPath.item %2 == 0) {width = 30;}}return CGSizeMake(width, 20);
}- (CGSize)sizeForHeaderViewAtSection:(NSInteger)section
{return CGSizeMake(375, 40);
}#pragma mark  - lazy load- (UICollectionView *)collectionView
{if (!_collectionView) {LBMutilMutilAutoWidthLayout *layout = [[LBMutilMutilAutoWidthLayout alloc] init];layout.delegate = self;layout.contentWidth = 375;layout.minimumInteritemSpacing = 10;layout.sectionInset = UIEdgeInsetsZero;_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 100, 375, 400) collectionViewLayout:layout];_collectionView.dataSource = self;_collectionView.delegate = self;[_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"22"];[_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"];}return _collectionView;
}@end
http://www.dtcms.com/wzjs/8516.html

相关文章:

  • 用手机做网站的app推广网络营销案例
  • wordpress如何在底部设置备案合肥品牌seo
  • 微信公众号服务号网站开发流程公众号怎么引流推广
  • 评网网站建设seo站内优化最主要的是什么
  • 用dw做的个人网站网络运营具体做什么
  • 做外贸的物流网站百度知道首页官网
  • 网站建设优選宙斯站长seo网站推广
  • 网站建设运行维护合同兰州压热搜
  • 个人网站设计与开发游戏推广员每天做什么
  • 西樵网站制作公司seo是做什么的
  • 自做网站打开速度慢国内最新消息新闻
  • 可以做软件的网站高端营销型网站
  • 做网页怎么在网站播放视频seo最新快速排名
  • 四川建设工程网站餐饮培训
  • 简单工程承包合同兰州seo优化公司
  • 郑州市人民政府官方网站精准营销
  • p2p网站建设报价百度首页优化
  • 云县网站建设找那家网络营销的方法包括哪些
  • 天津做不锈钢的网站市场调研报告范文
  • 安丘做网站的公司百度推广外包
  • 企业网站建设一般要素包括企业网络营销案例
  • synology做网站服务器seo快速排名工具
  • 织梦网站栏目是做什么用的seo自学教程
  • 文化共享工程网站建设情况百度引擎
  • espcms易思企业网站系统合肥百度推广优化排名
  • 郑州企业做网站h汉狮北京全网营销推广公司
  • 怎么做免费网站教程网站优化排名优化
  • 中咨工程咨询有限公司推广网站排名优化seo教程
  • 出口做谷歌网站视频推广方案模板
  • 公司找网站做宣传做账搜索排名优化