iOS TableView

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

//根據(jù)indexPath返回對應(yīng)位置的cell,如果cell不存在返回nil。

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

//返回每組多少行,系統(tǒng)會先調(diào)用兩次,第三次的時候才調(diào)用-tableview:cellForRowAtIndexPath;

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

//返回cell單元格,返回nib會導(dǎo)致程序crash。

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

//在指定的地方插入cell,第一個參數(shù)是入播的地位,第二個參數(shù)是動畫效果。

//調(diào)用這個方法后,系統(tǒng)會調(diào)用-tableView: numberOfRowsInSection;代理方法。如果在調(diào)用該方法之前,數(shù)據(jù)源沒有增加同插入cell個數(shù)等量的數(shù)據(jù),程序會出現(xiàn)crash。

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

// 返回nil或代表部分和行索引路徑選擇。

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

//從復(fù)用池提取Cell,如果復(fù)用池中沒有可用的Cell且registerNib或registerClass注冊cell,會返回一個新的cell,否則會返回nil。

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

//從復(fù)用池提取Cell,如果復(fù)用池中沒有可用的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);

//通過類注冊組頭或組尾。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容