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

长沙零基础学快速建站工会网站群建设方案

长沙零基础学快速建站,工会网站群建设方案,做货代用什么网站找客户,孝感网站开发不知道写了多少次collectionview#xff0c;步了很多坑#xff0c;现在看来虽然达到了自己想要的结果#xff0c;却不知道其中所以然。还是总结一下#xff0c;免得再走弯路#xff1b; 场景是这样的#xff0c;我要定制一个显示选择图片的排列#xff0c;想要实现横向排…不知道写了多少次collectionview步了很多坑现在看来虽然达到了自己想要的结果却不知道其中所以然。还是总结一下免得再走弯路 场景是这样的我要定制一个显示选择图片的排列想要实现横向排列4个等间距多了折行显示的效果正确的做法是这样的 - (void)viewDidLoad {[super viewDidLoad];self.navigationController.navigationBar.translucent NO;if ([self respondsToSelector:selector(setAutomaticallyAdjustsScrollViewInsets:)]) {self.automaticallyAdjustsScrollViewInsets NO;}self.view.backgroundColor [UIColor purpleColor];self.photoArray [[UIImage imageNamed:cycle3],[UIImage imageNamed:cycle4],[UIImage imageNamed:cycle2],[UIImage imageNamed:cycle3],[UIImage imageNamed:cycle4],].mutableCopy;[self.view addSubview:self.pickPhotoCollection]; }-(UICollectionView *)pickPhotoCollection{if (!_pickPhotoCollection) {UICollectionViewFlowLayout *layout [[UICollectionViewFlowLayout alloc]init];layout.scrollDirection UICollectionViewScrollDirectionVertical;_pickPhotoCollection [[UICollectionView alloc]initWithFrame:CGRectMake(0, 200, kScreenWidth, (self.photoArray.count/4 1)*80) collectionViewLayout:layout];_pickPhotoCollection.delegate self;_pickPhotoCollection.dataSource self;_pickPhotoCollection.backgroundColor RGBACOLOR(240, 240, 240, 1);_pickPhotoCollection.showsHorizontalScrollIndicator NO;[_pickPhotoCollection registerClass:[XJPickPhotoCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XJPickPhotoCollectionViewCell class])];}return _pickPhotoCollection; } -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{return 1; }-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{return self.photoArray.count 1 9 ? 9 : self.photoArray.count 1; }-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{XJPickPhotoCollectionViewCell *cell (XJPickPhotoCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XJPickPhotoCollectionViewCell class]) forIndexPath:indexPath];//判断图片的显示方式 如果不是9张图 则显示可以继续添加if (self.photoArray.count 9) {cell.photoImageView.image self.photoArray[indexPath.row];return cell;}if (indexPath.row self.photoArray.count) {cell.photoImageView.image [UIImage imageNamed:addPhoto];}else{cell.photoImageView.image self.photoArray[indexPath.row];}return cell; }-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{return CGSizeMake(WidthScale(70), WidthScale(70)); } -(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{ // return 2;return (kScreen_width - WidthScale(70)*4 - 10 )/3.; } //-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{ // return (kScreen_width - WidthScale(70)*4 - 10 )/3.; //} -(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{return UIEdgeInsetsMake(5, 5, 5, 5); } 关键点在这里 1-layout.scrolldirection uicollectionViewScrollDirectionVertical;collection的滚动方向由于要折行向下所以方向是垂直方向在排列的时候会默认选择先将横向排列完毕折行向下。 2-- minmumlinespaceing 这个这个属性用来指示行与行之间的最小距离(纵向)或者列与列之间的最小距离(横向)。无论横向或者纵向都可以滚动显示所有内容所以这个属性可以单独设置。  SO 在不同的滚动方向上要分清楚他的作用我就是在这里弄的头晕目眩  当然interitem就很好理解了     另外还有一点是   如果是自定义的layoutlayout的代理方法是不会执行的若想达到相同的效果需要在自定义的layout内部进行处理         layout.scrollDirection UICollectionViewScrollDirectionVertical;  转载于:https://www.cnblogs.com/lidarui/p/6931415.html
http://www.zqtcl.cn/news/175851/

相关文章:

  • 贵州省都匀市网站建设it培训机构培训排名
  • 网站开发的技术栈网页设计1920尺寸
  • 在中国可以做国外的域名网站吗中国建设银行人力资源网站
  • 中石化第四建设公司 网站电商app开发价格表
  • dhru商城网站建设免费英文网站建设
  • 公司建设网站的 计划书深圳华强北电子商城
  • 宁波网站建设有限公司大圣网站建设
  • wish网站应该怎么做网站的html代码在哪
  • 哪个网站可以做体育主播站长工具seo综合查询怎么去掉
  • 哪个网站做logo设计师公司做网站需要什么资料
  • 想自己做衣服上哪个网站学网站设计网上培训学校
  • 做餐饮的网站云匠网可能会遇到哪些问题
  • 制作网页网站的软件是网络科技公司怎么注册
  • 如何做百度推广网站价格网如何查产品价格
  • 织梦移动网站后缀找生意项目
  • 深圳高端网站建设美工步骤图
  • 指数网站网站用ps下拉效果怎么做
  • 李沧网站建设电话从化企业网站建设
  • 北京电商网站建设公司新康家园网站建设
  • 广西注册公司网站企业高端网站制作
  • 国安中建建设集团网站南京网页设计培训班
  • 网站如何制作建设内容社交电商平台
  • 无法连接到wordpress站点网站建设两个方面
  • 广东官网网站建设品牌未来做啥网站能致富
  • 网站建设合同副本珠海微网站建设
  • wordpress 多语言 站点数据分析师报名入口
  • 做网站长尾词品牌设计模板
  • 企业建立网站的优势阿里云做网站号码
  • 江苏住房城乡建设厅网站一千块钱能注册公司吗
  • 山东兴华建设集团有限公司网站分类信息网站怎么做