UITableViewDataSource TableView數據源協議
主要进行,数据的编辑(删除,插入),索引,移动排序的操作,是否允许编辑(删除,插入)和移动排序,设置显示的行数,组数,单元格的显示
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
返回的是一組數據有多少行
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
cell訪問數據源然後加載到tableView
-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView;
返回有多少組,多少部分(默認是1,這個方法可以不實現)
-(NSString *)tableView:(UITableView *) titleForHeaderInSection:(NSInteger)section;
(固定的字體fixed font style,如果你想要不同的樣子,使用 custom view(UILabel))
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
控制行能否移動,return NO就不能执行排序操作了(比如移动按钮不会出现了)
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
控制能否编辑,如果return NO 不能执行编辑操作了(比如删除不会出现了)
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
要求的指定部分的表格视图的页眉标题数据源。
-(NSString *)tableVIew:(UITableView *)tableVIew titleForFooterInSection:(NSInteger)section;
要求的指定部分的表格视图的页脚标题数据源。
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView;
返回每组的标题,标题显示在索引视图中
-(Integer)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index;
返回分组的索引位置(在这个方法里面可以接收到索引的标题是什么,如果写成固定的值,那么点击索引不会对应的跳动了)
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle) editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;
对特定的行进行删除跟插入的操作(editingStyle,编辑类型,可以通过他来区分是删除还是插入
)
-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
对数据源将排在表视图中的一个特定的位置到另一个位置。(排序的操作用这个方法操作)
详细解决方案
UITableViewDataSource TableView數據流協議
热度:146 发布时间:2016-04-25 05:45:13.0
相关解决方案
- tableview和QSqltableModel结合使用时,当数据多于256,tableview->scrollToBottom()就只停留在256上,如何解决
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath不执行的有关问题
- UITableViewDataSource TableView數據流協議
- tableview 全选有关问题
- tableView 下拉刷新,卡。该如何解决
- tableView cellforrowatindexpath 方法不掉用解决办法
- tableView cellforrowatindexpath 步骤不掉用
- tableView 下拉刷新,卡。该怎么解决
- tableview 等图片上载完再更新cell内的uiimage
- iOS tableview 往下跌动后,上面的多选效果没了,不过数据还在
- iOS tableview 往上滑动后,下面的多选效果没了,不过数据还在
- iOS tableView 上下偏移
- iOS tableView 加载到最后一行之后再刷新一次页面方法
- tableView 设置使用宏定义
- iOS 设置 tableView 代理, 注册 cell, 自适应高度.
- iOS TableView 滚动到最后一行
- TableView 代理方法详细解释
- Tableview 默认选中第一行以及选中背景自定义
- tableview 把某个视图移到前者上面
- tableView 上拉刷新/下拉加载
- tableview 多选删除
- ios tableView那些事 (十四) 获取 tableview 每个cell 的坐标点
- ios tableView那些事 (十一) 让 tableview 不可滚动或屏蔽掉
- ios tableView那些事 (十)设置 tableview 的分割线
- ios tableView那些事(四)tableView添加标题,头尾和改变cell的宽度 分类: Ios tableview 2013-08-28 19:07 12096人阅读 评论(0) 收藏
- iOS tableview/collectionview索引联动之字母调动 (ndexPathsForVisibleItems返回不按顺序)