首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏三掌柜的技术空间

    iOS开发:UICollectionViewCell删除的实现方法

    本篇博文就来讲解一下UICollectionView使用中,删除UICollectionViewCell的步骤方法,仅供参考。 使用场景:在UICollectionView的cell中,点击长按手势删除列表中的其中一个UICollectionViewCell的方法。具体实现步骤如下所示。 dateSource = [NSMutableArray arrayWithArray:customArr]; 2、在UICollectionView代理方法cellForItemAtIndexPath:中给UICollectionViewCell recognizer.state == UIGestureRecognizerStateEnded) { NSLog(@"结束触发长按操作"); } } 通过以上的步骤,大概演绎了一个简单的删除UICollectionViewCell

    2.6K41编辑于 2021-12-03
  • 来自专栏梧雨北辰的开发录

    使用xib自定义UIcollectionViewCell控件为nil的问题

    该怎么说呢,这是一个很坑的事情,今天在完成一个界面的时候,用了xib来自定义UICollectionViewCell。 [_collectionView registerNib:nib forCellWithReuseIdentifier:@"MyCollectionCellID"]; //使用集合视图单元格 - (UICollectionViewCell

    1.7K50发布于 2018-04-24
  • 来自专栏大师级码师

    UICollectionView 的使用详解

    class] forCellWithReuseIdentifier:@"UICollectionViewCell"]; [self.view addSubview:self.collectionView ]; } pragma mark -- UICollectionViewDataSource //定义展示的UICollectionViewCell的个数 -(NSInteger)collectionView collectionView cellForItemAtIndexPath:(NSIndexPath )indexPath { static NSString CellIdentifier = @"UICollectionViewCell "; UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier cell = (UICollectionViewCell )[collectionView cellForItemAtIndexPath:indexPath]; //临时改变个颜色,看好,只是临时改变的

    1.2K00发布于 2021-10-31
  • 来自专栏iOS逆向与安全

    iOS UICollectionView 从右向左对齐的实现

    UICollectionViewCell内部包含子视图自定义按钮ERPbtn4Radius 1.1 核心步骤 首先,在创建UICollectionView时,对其进行了水平翻转: [_ collectionView setTransform:CGAffineTransformMakeScale(-1,1)]; 在更新UICollectionViewCell的数据模型时,对它的contentView CGSizeMake(self.collectionView.width/ 5, kAdjustRatio(k_cell_H)); return size; } - (UICollectionViewCell 的完整代码 UICollectionViewCell内部包含子视图自定义按钮ERPbtn4Radius 2.1 自定义UICollectionViewCell h @interface ERPBtnCollectionViewCell : UICollectionViewCell @property (nonatomic,strong) QCTCollectionModel *model; @property (weak, nonatomic

    3.2K40发布于 2021-07-29
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列一——初识与简单使用UICollectionView

    collect.delegate=self;     collect.dataSource=self;     //注册item类型 这里使用系统的类型     [collect registerClass:[UICollectionViewCell cell的方法,没有再提供可以返回nil的方式,并且在UICollectionView的回调代理中,只能使用从复用池中获取cell的方式进行cell的返回,其他方式会崩溃,例如: //这是正确的方法 -(UICollectionViewCell  * cell = [[UICollectionViewCell alloc]init];     return cell; } 上面错误的方式会崩溃,信息如下,让我们使用从复用池中取cell的方式:  *)cell; //根据indexPath获取cell - (nullable UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath  *)indexPath; //获取所有可见cell的数组 - (NSArray<__kindof UICollectionViewCell *> *)visibleCells; //获取所有可见cell

    4.4K20发布于 2018-08-16
  • 来自专栏全栈程序员必看

    IOS基金会_ UICollectionView简单易用

    alloc] initWithFrame:self.view.bounds collectionViewLayout:layout]; [collectionView registerClass:[UICollectionViewCell [self.view addSubview:collectionView]; } 实现代理方法 #pragma mark –UICollectionViewDataSource //定义展示的UICollectionViewCell collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell * cell = (UICollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath]; cell.backgroundColor )%255)/255.0) green:((arc4random()%255)/255.0) blue:((arc4random()%255)/255.0) alpha:1.0f]; } //返回这个UICollectionViewCell

    55510编辑于 2022-07-06
  • 来自专栏编程之路

    Swift纯代码构建UICollectionView

    collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell text = "wangjie" return cell } 5.自定义UICollectionViewCell为SHomeCell // // SHomeCell.swift All rights reserved. // import UIKit class SHomeCell: UICollectionViewCell { let width = UIScreen.mainScreen } } 6.初始化UICollectionView并注册UICollectionViewCell。 collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

    2.2K30发布于 2018-08-30
  • 来自专栏一“技”之长

    iOS第三方左对齐布局类——UICollectionViewLeftAlignedLayout

    self.collectionView.dataSource = self; self.collectionView.delegate=self; [self.collectionView registerClass:[UICollectionViewCell collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return 10; } -(UICollectionViewCell collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ UICollectionViewCell

    2.3K20发布于 2018-08-15
  • 来自专栏iOS小生活

    UICollectionView

    collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section; - (__kindof UICollectionViewCell *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath; 我们知道,UITAbleViewCell是有四种默认样式的,但是UICollectionViewCellUICollectionViewCell的获取,必须是先注册,然后通过dequeue方法获取。 系统默认给我们提供了一种layout——UICollectionViewFlowLayout。

    1.6K20发布于 2019-08-12
  • 来自专栏码客

    iOS UICollectionView的用法

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell collectionView numberOfItemsInSection:(NSInteger)section{ return self.tableData[section].count; } -(UICollectionViewCell self.collectionView.frame.size.height); } - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

    1.8K20发布于 2019-10-22
  • 来自专栏云原生布道专栏

    【IOS开发基础系列】UICollectionView专题

    1.5 关于Cell         相对于UITableViewCell来说,UICollectionViewCell没有这么多花头。 首先UICollectionViewCell不存在各式各样的默认的style,这主要是由于展示对象的性质决定的,因为UICollectionView所用来展示的对象相比UITableView来说要来得灵活 因此SDK提供给我们的默认的UICollectionViewCell结构上相对比较简单,由下至上:     • 首先是cell本身作为容器view     • 然后是一个大小自动适应整个cell的backgroundView 重用         UICollectionViewCell其实只实例化了能应付一屏显示范围的对象实例,而在cellForItemAtIndexPath方法中重复更新此实例的业务数据来达到显示不同Cell UICollectionViewCell的实例化是通过dequeueReusableCellWithReuseIdentifier来实现,代码示例如下: HJInfoCollectionCell *cell

    3.2K30编辑于 2023-10-16
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列五——圆环布局的实现

    collectionViewLayout:layout];     collect.delegate=self;     collect.dataSource=self;          [collect registerClass:[UICollectionViewCell collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{     return 10; } -(UICollectionViewCell collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{     UICollectionViewCell

    1.9K20发布于 2018-08-16
  • 来自专栏编程之路

    Swift纯代码 UICollectionView 分组显示、Cell圆角、选中变色

    backgroundColor = UIColor.whiteColor() } 5.自定义圆角带边框的UICollectionViewCell。 All rights reserved. // import UIKit class SHomeCell: UICollectionViewCell { var titleLabel collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

    5.7K10发布于 2018-08-30
  • 来自专栏我杨某人的青春满是悔恨

    教你写个多表视图

    接下来我们要自定义一个UICollectionViewCell,让它包含一个 tableView: class HomeCollectionViewCell: UICollectionViewCell collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

    2K30发布于 2018-09-10
  • 来自专栏sktj

    IOS UICollectionView 图片展示墙

    19 collectionView.dataSource = self 20 collectionView.delegate = self 21 collectionView.register(UICollectionViewCell.classForCoder 29 func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath:IndexPath) -> UICollectionViewCell

    2.7K40发布于 2019-07-08
  • 来自专栏MelonTeam专栏

    封装内嵌UICollectionView和UIPageControl的ScrollView

    UICollectionViewUICollectionViewUICollectionViewUICollectionView 灰色的是容器View 紫色的是UIScrollView 蓝色的是UICollectionView 红色的是UICollectionViewCell NSInteger groupIndex = collectionView.tag - 100; return _listData[groupIndex].itemList.count; } - (UICollectionViewCell = [NSString stringWithFormat:@"ItemLandscapeCollectionCellIdentifier_%ld",collectionView.tag]; UICollectionViewCell

    2K90发布于 2018-01-04
  • 来自专栏iOS开发干货分享

    抛弃UITableView,让所有列表页不再难构建

    第一个需求:显示用户名和文字内容 准备两个cell class UserInfoCell: UICollectionViewCell { @IBOutlet weak var avatarView = UIColor.purple self.nameLabel.text = viewModel.userName } } class ContentCell: UICollectionViewCell class FavorCell: UICollectionViewCell { @IBOutlet weak var favorBtn: UIButton! class ImageCollectionCell: UICollectionViewCell { let padding: CGFloat = 10 @IBOutlet weak var 的滑动,二是把UITableView嵌套进UICollectionViewCell,这个可能得好好封装一下了。

    2.2K30发布于 2019-06-14
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列三——使用FlowLayout进行更灵活布局

    collectionViewLayout:layout];     collect.delegate=self;     collect.dataSource=self;          [collect registerClass:[UICollectionViewCell collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{     return 100; } -(UICollectionViewCell collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{     UICollectionViewCell

    2.4K30发布于 2018-08-16
  • 来自专栏码客

    iOS 引导页实现方式

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell }else{ self.pageControl.isHidden = false; } } 用到的Cell import UIKit class WelcomeCell: UICollectionViewCell

    1.7K10发布于 2019-10-22
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列二——UICollectionView的代理方法

    collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section; 设置返回每个item的属性 - (UICollectionViewCell indexPath; 将要加载某个Item时调用的方法 - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell ); 已经展示某个Item时触发的方法 - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell

    2.5K20发布于 2018-08-16
领券