美文网首页
tableView的一些总结用于新手观看

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

作者: 方圆十里不留母狗 | 来源:发表于2016-04-17 22:32 被阅读99次

// 表格样式@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;

相关文章

网友评论

      本文标题: tableView的一些总结用于新手观看

      本文链接:https://www.haomeiwen.com/subject/ghoolttx.html