码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2014-12-25 16:35:46      阅读:181      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!