首页 > 其他 > 详细

UITableView的详细使用

时间:2015-07-10 00:04:16      阅读:293      评论:0      收藏:0      [点我收藏+]

 

首先创立  tableView

UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];

    [self addSubview:tableView];

 

 

#pragma mark 设置TableView上面显示的内容 使用此方法时候需要注意,一定要使用重用机制,否则会出现文字或图像重叠的现象

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

 

 

#pragma mark - 重写----设置有多少个分组

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

 

 

#pragma mark - 重写----设置每个分组上面有多少单元格

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

 

 

#pragma mark - 重写---修改行高

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return 44; // 返回多少即设置行高为多少

}

 

 

#pragma mark - 重写----设置单元格分组的标题和标注的高度

#pragma mark 设置分组上面的标题的高度

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;

#pragma mark 设置分组下面的标注的高度

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

UITableView的详细使用

原文:http://www.cnblogs.com/lhp-1992/p/4634468.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!