首页 > 移动平台 > 详细

IOS 学习笔记 —— tableView 使用详解(一)

时间:2014-12-25 16:34:54      阅读:341      评论:0      收藏:0      [点我收藏+]


1 去除分割线

//去除分割线
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

2 高度设置

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
    return cell.frame.size.height;
    //自定义高度
//    return 110;
}

3 自定义Cell,后面会详细列出如何自定义cell,由于时间关系,这里暂时给出使用方法,如下:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //MyCell是自己定义的Cell类
    MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];
    if (!cell) {
        NSArray *objects = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil];
        for (NSObject *o in objects) {
            if ([o isKindOfClass:[MyCell class]]) {
                cell = (MyCell *)o;
                break;
            }
        }
    }
    
    //Configure you cell
    //...
    
    return cell;
}




3


IOS 学习笔记 —— tableView 使用详解(一)

原文:http://my.oschina.net/bingshanguxue/blog/360415

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