UITableView——1
2016-07-05 11:10
387 查看
UITableViewController
要实现2个delegate,即UITableViewDataSource,
UITableViewDelegate
UITableViewDataSource
必须实现的代理
@class UITableView;
@class UINib;
@protocol UITableViewDataSource;
@class UILongPressGestureRecognizer;
@class UITableViewHeaderFooterView;
@class UIRefreshControl;
@class UIVisualEffect;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; //节中的行数
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; //索引路径上的行的单元格
选择实现的代理
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
// 如果未实现,默认为1
- (nullable
NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
// 固定字体样式。使用自定义视图(UILabel)如果你想要不同的东西
- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
// 编辑
// 单个行可以选择退出为它们设置的-编辑属性集。如果不执行,所有的行被认为是可编辑的
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
// Moving/reordering
// 允许排序辅助视图可以显示为一个特定的行。默认情况下,订货控制将只显示如果DataSource工具--党moverowatindexpath:toindexpath
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
// Index
- (nullable NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView
__TVOS_PROHIBITED;
// return list of section titles to display in section index view (e.g. "ABCD...Z#")
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
__TVOS_PROHIBITED;
// tell table which section corresponds to section title/index (e.g. "B",1))
// Data manipulation - insert and delete support
// After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change
// Not called for edit actions using UITableViewRowAction - the action's handler will be invoked instead
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath
*)indexPath;
// Data manipulation - reorder / moving support
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath
*)destinationIndexPath;
UITableViewCell
要实现2个delegate,即UITableViewDataSource,
UITableViewDelegate
UITableViewDataSource
必须实现的代理
@class UITableView;
@class UINib;
@protocol UITableViewDataSource;
@class UILongPressGestureRecognizer;
@class UITableViewHeaderFooterView;
@class UIRefreshControl;
@class UIVisualEffect;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; //节中的行数
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; //索引路径上的行的单元格
选择实现的代理
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
// 如果未实现,默认为1
- (nullable
NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
// 固定字体样式。使用自定义视图(UILabel)如果你想要不同的东西
- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
// 编辑
// 单个行可以选择退出为它们设置的-编辑属性集。如果不执行,所有的行被认为是可编辑的
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
// Moving/reordering
// 允许排序辅助视图可以显示为一个特定的行。默认情况下,订货控制将只显示如果DataSource工具--党moverowatindexpath:toindexpath
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
// Index
- (nullable NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView
__TVOS_PROHIBITED;
// return list of section titles to display in section index view (e.g. "ABCD...Z#")
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
__TVOS_PROHIBITED;
// tell table which section corresponds to section title/index (e.g. "B",1))
// Data manipulation - insert and delete support
// After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change
// Not called for edit actions using UITableViewRowAction - the action's handler will be invoked instead
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath
*)indexPath;
// Data manipulation - reorder / moving support
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath
*)destinationIndexPath;
UITableViewCell
相关文章推荐
- APUE 《UNIX环境高级编程》编译问题彻底解决方案
- 关于 failed to find build tools revision 23.0.0 rc3的问题
- 关于${pageContext.request.contextPath }对于工程中的那个目录
- APUE[ "apue.h" ]
- C# Maximum request length exceeded. 产生错误的原因,以及解决方法.
- UIButton
- UIlabel 文字颜色不同
- 深入理解android UI Thread
- flash builder概要分析器使用
- document自带的强大的选择器querySelector/querySelectorAll
- leetcode:Longest Increasing Subsequence
- java.lang.Enum.valueOf()方法实例
- java语言基础入门——break,continue介绍
- reason: -[UIKBBlurredKeyView candidateList]: unrecognized selector sent to instance
- 获取request请求的ip地址
- B-JUI学习
- UILabel
- UIAlertController
- UIWindow加点击手势,上面的UITableView点击失效
- git 官方文档