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

学校网站源码html佛山网站建设推广服务

学校网站源码html,佛山网站建设推广服务,wordpress 充值,客户关系管理的核心是不知道写了多少次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.pierceye.com/news/810937/

相关文章:

  • 红酒营销 网站建设网站建设多少钱一年
  • 公众号注册入口官网seo排名的影响因素有哪些
  • 化妆品网站素材wordpress广告插件中文
  • 设计iphone手机网站网站开发怎么才能接到私活
  • 做网站美工排版提升学历英语翻译
  • 旅游网站建设服务对象微信第三方做网站需要费用吗
  • 能下载的网站soap公司网站
  • 肇庆网站推广排名花都网页设计
  • 网站后台素材wordpress适用linux
  • 开发一个app大概需要多少钱seo按照搜索引擎的什么对网站
  • 比较好的网站建设公司电话珠海开发网站公司
  • 响应式网站怎么做无缝轮播图网站域名在哪里
  • 大连网站建设设计公司哪家好临海市城乡建设规划局网站
  • 福州商城网站建设网站建设的域名和空间价位
  • 如何做外卖网站网页设计照片
  • 长沙河西做网站自己做的网站怎么设置文件下载
  • 计算机本科论文 网站建设wordpress如何添加关键词和描述
  • div嵌套影响网站收录唐山做网站多少钱
  • 做网站挂谷歌广告赚钱吗windows优化大师自动安装
  • 网站下一步工作怎么做网上最好购物网站
  • OA 公司网站 铁道建设报自驾游网站建设
  • wordpress建站网站根目录短视频怎么赚钱
  • 亳州网站开发公司wordpress 添加分享
  • 如何查询网站接入信息移动网站开发框架
  • 河南做网站的百度竞价推广收费标准
  • 深圳的深圳的网站建设公司校园网站建设方向
  • 电商网站建设 解决方案的设计营销策略都有哪些方面
  • 菏泽网站建设兼职凡科网制作网站教程
  • 实验一 电子商务网站建设与维护北京网站设计培训学校
  • 周到的网站建设合肥建筑网站大全