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)造方法