cell

⾃自定义cell的步骤

别等时光非礼了梦想. 提交于 2020-02-27 10:26:42
⾃自定义cell的步骤(每个cell的⾼高度不⼀一样,每个cell⾥里⾯面显⽰示的 内容也不⼀一样) 新建⼀一个继承⾃自UITableViewCell的⼦子类 2. 在initWithStyle:⽅方法中进⾏行⼦子控件的初始化 1> 将有可能显⽰示的所有⼦子控件都添加到contentView中 2> 顺便设置⼦子控件的⼀一些属性(⼀一次性的设置:字体、⽂文字颜⾊色、 背景 3. 提供2个模型 1> ⼀一个是数据模型(⽂文字数据 + 图⽚片数据) 2> ⼀一个是frame模型(数据模型 + 所有⼦子控件的frame + cell 的⾼高度) 4. cell应该提供⼀一个frame模型属性 1> 将frame模型传递给cell 2> cell根据frame模型给⼦子控件设置frame,根据数据模型给⼦子控 件设置数据 3> cell根据数据模型决定显⽰示和隐藏哪些⼦子控件 5. 在tableView的代理⽅方法返回cell的⾼高度 来源: https://www.cnblogs.com/aoxer/p/4953421.html

iOS cell手势左滑、右滑

僤鯓⒐⒋嵵緔 提交于 2020-02-27 08:50:51
MGSwipeTableCell - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString * reuseIdentifier = @"programmaticCell"; MGSwipeTableCell * cell = [self.tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; if (!cell) { cell = [[MGSwipeTableCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier]; } cell.textLabel.text = @"Title"; cell.detailTextLabel.text = @"Detail text"; cell.delegate = self; //optional //configure left buttons cell.leftButtons = @[[MGSwipeButton buttonWithTitle:@"" icon:

iOS之可拖拽重排的CollectionView

怎甘沉沦 提交于 2020-02-27 04:36:38
修复了拖拽滚动时抖动的一个bug,新增编辑模式,进入编辑模式后不用长按触发手势,且在开启抖动的情况下会自动进入抖动模式,如图: test.gif 图1:垂直滚动 drag1.gif 图2:水平滚动 drag2.gif 图3:配合瀑布流(我直接使用了上个项目的瀑布流模块做了集成实验) drag5.gif 我将整个控件进行了封装,名字是 XWDragCellCollectionView 使用起来非常方便,github地址: 可拖拽重排的CollectionView ;使用也非常简单,只需3步,步骤如下: 1、继承于XWDragCellCollectionView; 2、实现必须实现的DataSouce代理方法:(在该方法中返回整个CollectionView的数据数组用于重排) - (NSArray *)dataSourceArrayOfCollectionView:(XWDragCellCollectionView *)collectionView; 3、实现必须实现的一个Delegate代理方法:(在该方法中将重拍好的新数据源设为当前数据源)(例如 :_data = newDataArray) - (void)dragCellCollectionView:(XWDragCellCollectionView *)collectionView newDataArrayAfterMove

UITableView学习总结

老子叫甜甜 提交于 2020-02-27 03:53:09
一、UITableView概述 UITableView继承自UIScrollView,可以表现为Plain和Grouped两种风格。 UITableView有两个Delegate分别为:dataSource和delegate。   · dataSource 是UITableViewDataSource类型,主要为UITableView提供显示用的数据(UITableViewCell),指定UITableViewCell支持的编辑操作类型(insert,delete和reordering),并根据用户的操作进行相应的数据更新操作,如果数据没有更具操作进行正确的更新,可能会导致显示异常,甚至crush。   · delegate 是UITableViewDelegate类型,主要提供一些可选的方法,用来控制tableView的选择、指定section的头和尾的显示以及协助完成cell的删除和排序等功能。   (其中UITableView声明了一个NSIndexPath的类别,主要用来标识当前cell的在tableView中的位置,该类别有section和row两个属性,前者标识当前cell处于第几个section中,后者代表在该section中的第几行。) UITableView只能有一列数据(cell),且只支持纵向滑动,当创建好的tablView第一次显示的时候

IOS UITableView NSIndexPath属性讲解

爷,独闯天下 提交于 2020-02-27 03:52:08
查看UITableView的帮助文档我们会注意到UITableView有两个Delegate分别为:dataSource和delegate。    dataSource 是UITableViewDataSource类型,主要为UITableView提 供显示用的数据(UITableViewCell),指定UITableViewCell支持的编辑操作类型(insert,delete和 reordering),并根据用户的操作进行相应的数据更新操作,如果数据没有更具操作进行正确的更新,可能会导致显示异常,甚至crush。    delegate 是UITableViewDelegate类型,主要提供一些可选的方法,用来控制tableView的选择、指定section的头和尾的显示以及协助完成cell的删除和排序等功能。   提到UITableView,就必须的说一说NSIndexPath。UITableView声明了一个NSIndexPath的类别,主要用 来标识当前cell的在tableView中的位置,该类别有section和row两个属性,前者标识当前cell处于第几个section中,后者代 表在该section中的第几行。   UITableView只能有一列数据(cell),且只支持纵向滑动,当创建好的tablView第一次显示的时候,我们需要调用其reloadData方法

iOS开发--UITableView

时光总嘲笑我的痴心妄想 提交于 2020-02-27 03:20:10
-、建立 UITableView DataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)]; [DataTable setDelegate:self]; [DataTable setDataSource:self]; [self.view addSubview:DataTable]; [DataTable release]; 二、UITableView各Method说明 //Section总数 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ return TitleData; } // Section Titles //每个section显示的标题 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return @""; } //指定有多少个分区(Section),默认为1 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 4; } //指定每个分区中有多少行,默认为1

uitableview

£可爱£侵袭症+ 提交于 2020-02-27 03:19:43
-、建立 UITableView DataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)]; [DataTable setDelegate:self]; [DataTable setDataSource:self]; [self.view addSubview:DataTable]; [DataTable release]; 二、UITableView各Method说明 //Section总数 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ return TitleData; } // Section Titles //每个section显示的标题 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return @""; } //指定有多少个分区(Section),默认为1 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 4; } //指定每个分区中有多少行,默认为1

iPhone应用开发 UITableView学习点滴详解

痴心易碎 提交于 2020-02-27 03:18:59
iPhone 应用开发 UITableView 学习点滴详解是本文要介绍的内容,内容不多,主要是以代码实现 UITableView 的学习点滴,我们来看内容。 -、建立 UITableView DataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)]; [DataTable setDelegate:self]; [DataTable setDataSource:self]; [self.view addSubview:DataTable]; [DataTable release]; 二、UITableView各Method说明 //Section总数 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ return TitleData; } // Section Titles //每个section显示的标题 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return @""; } //指定有多少个分区(Section),默认为1 - (NSInteger

UITableView详解

匆匆过客 提交于 2020-02-27 03:18:47
UITableView详解 // 创建 UITableView( 所在类中要遵从UITableView 的 UITableViewDataSource 和 UITableViewDelegate 协议) UITableView *dataTable = [[UITableView alloc] initWithFrame:CGRectMake( 0, 0, 320, 420)]; dataTable.delegate = self; dataTable.dataSource = self; [ self.view addSubview:dataTable]; [dataTable release]; // UITableView 各Method 说明 // Section 总数 - ( NSArray *)sectionIndexTitlesForTableView:( UITableView *)tableView {   return TitleData; } // Section 显示的标题 - ( NSString *)tableView:( UITableView *)tableView titleForHeaderInSection:( NSInteger)section {    return @"sectionA" ; } // 指定有多少个分区(Section)

iOS UITableView的一些方法

这一生的挚爱 提交于 2020-02-27 03:16:57
项目中用到的一些tabview 问题及对应方法: 一.tableview 1.下划线左对齐 //步骤一:(加在 viewdidload方法中) if([tabView respondsToSelector:@selector(setSeparatorInset:)]) { [tabView setSeparatorInset:UIEdgeInsetsZero]; } if ([tabView respondsToSelector:@selector(setLayoutMargins:)]) { [tabView setLayoutMargins:UIEdgeInsetsZero]; }//步骤二:修改分割线方法 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector