iOS TableView

- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;   

//根据indexPath返回对应位置的cell,如果cell不存在返回nil。

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

//返回每组多少行,系统会先调用两次,第三次的时候才调用-tableview:cellForRowAtIndexPath;

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

//返回cell单元格,返回nib会导致程序crash。

- (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;

//在指定的地方插入cell,第一个参数是入播的地位,第二个参数是动画效果。

//调用这个方法后,系统会调用-tableView: numberOfRowsInSection;代理方法。如果在调用该方法之前,数据源没有增加同插入cell个数等量的数据,程序会出现crash。

@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow; 

// 返回nil或代表部分和行索引路径选择。

- (nullable __kindof UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier;

//从复用池提取Cell,如果复用池中没有可用的Cell且registerNib或registerClass注册cell,会返回一个新的cell,否则会返回nil。

- (__kindof UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0); 

//从复用池提取Cell,如果复用池中没有可用的Cell且registerNib或registerClass注册cell,会返回一个新的cell,否则程序crash。

- (void)registerNib:(nullable UINib *)nib forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(5_0);

//通过Xib注册cell。

- (void)registerClass:(nullable Class)cellClass forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);

//通过类注册cell。

- (void)registerNib:(nullable UINib *)nib forHeaderFooterViewReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);

//通过xib注册组头或组尾。

- (void)registerClass:(nullable Class)aClass forHeaderFooterViewReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);

//通过类注册组头或组尾。

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

推荐阅读更多精彩内容