UITableView

UITableView

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style;
純代碼創(chuàng)建UITableview指定構(gòu)造方法
style:樣式
UITableViewStylePlain組與組之間沒有間隔 組頭懸停
UITableViewStyleGrouped組與組之間有間隔

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder;
xib storyBoard創(chuàng)建指定構(gòu)造方法

- (__kindof UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath;
生成UITableViewCell
identifier:可重用標(biāo)識(shí)

- (void)registerClass:(nullable Class)cellClass forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);
根據(jù) xib 注冊(cè)可重用標(biāo)識(shí)
- (void)registerNib:(nullable UINib *)nib forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(5_0);
根據(jù) 類 注冊(cè)可重用標(biāo)識(shí)

@property (nonatomic, strong, nullable) UIView *tableHeaderView;
設(shè)置表頭,只有height有效
@property (nonatomic, strong, nullable) UIView *tableFooterView;
設(shè)置表尾,height 和 x 有效

@property (nonatomic) CGFloat rowHeight;
設(shè)置行高
UITableViewAutomaticDimension:自動(dòng)計(jì)算行高
@property (nonatomic) CGFloat estimatedRowHeight;
預(yù)估行高

@property (nonatomic) UITableViewCellSeparatorStyle separatorStyle;
分割線樣式

UITabelViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
返回有多少組
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
返回每組有多少行
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
每行顯示單元格

- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
每組頭部顯示標(biāo)題
- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
每組尾部顯示標(biāo)題

- (nullable NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView;
返回組索引

UITableviewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier;
指定構(gòu)造方法

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

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

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