美文网首页
通过xib唤醒UITableViewCell

通过xib唤醒UITableViewCell

作者: KKFantasy | 来源:发表于2016-05-22 13:57 被阅读0次

tableView中配合的代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIndentifier = @"MyTableViewCell";//这里的cellID就是cell的xib对应的名称
    MyTableViewCell *cell = (MyTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIndentifier];
    if(nil == cell) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellIndentifier owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    return cell;
}

相关文章

网友评论

      本文标题:通过xib唤醒UITableViewCell

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