美文网首页
代码实现static cell

代码实现static cell

作者: 出门请右拐 | 来源:发表于2016-08-10 22:36 被阅读47次

用storyboard可以很方便的实现static cell,只需要在inspector中选择static cell即可,但是在代码中如何实现呢? 可以使用下面的代码来实现:

    NSString *cellIdentifier = [NSString stringWithFormat:@"%li", indexPath.row];
    MeasureTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[MeasureTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }

相关文章

网友评论

      本文标题:代码实现static cell

      本文链接:https://www.haomeiwen.com/subject/onvjsttx.html