tableView的一些总结用于新手观看

// 表格样式@property (nonatomic, readonly) UITableViewStyle style;

// 数据源@property (nonatomic, weak, nullable) iddataSource;

// 代理@property (nonatomic, weak, nullable) iddelegate;

// 设置行高@property (nonatomic) CGFloat rowHeight;

// tableView的方法

// 刷新表格--全局刷新- (void)reloadData;

// 获得indexPath行指定的cell- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;

// 刷新数组中指定的行--局部刷新- (void)reloadRowsAtIndexPaths:(NSArray*)indexPaths withRowAnimation:(UITableViewRowAnimation)animation- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;

// cell的常见属性//

 图片@property (nonatomic, readonly, strong, nullable) UIImageView *imageView

// 文本标签@property (nonatomic, readonly, strong, nullable) UILabel *textLabel

// 详情标签@property (nonatomic, readonly, strong, nullable) UILabel *detailTextLabel

// 容器控件@property (nonatomic, readonly, strong) UIView *contentView;

// 设置cell的选中样式(在iOS7之后,效果都是跟默认值一样)@property (nonatomic) UITableViewCellSelectionStyle  selectionStyle;

// 设置cell右边显示的辅助控件的类型@property (nonatomic) UITableViewCellAccessoryType    accessoryType;

// 设置cell右边显示的辅助控件@property (nonatomic, strong, nullable) UIView      *accessoryView;

// 设置背景控件@property (nonatomic, strong, nullable) UIView *backgroundView;// 设置cell选中时显示的控件@property (nonatomic, strong, nullable) UIView *selectedBackgroundView;

// cell的方法// 初始化方法- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier

// 数据源方法// 返回组数(默认1组)- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

// 返回第section对应的行数- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

// 返回indexPath行对应的cell- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

// 返回第section组对应的头部标题- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;

// 返回第section组对应的尾部描述- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;

// 返回分组索引的标题数组- (nullable NSArray*)sectionIndexTitlesForTableView:(UITableView *)tableView;

// 监听cell右边辅助按钮的点击事件

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;

// 代理方法

// 返回indexPath行对应行高

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;

// 监听indexPath行的选中事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容