IOS--常用控件--UITableView--xib自定义cell

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

{

    static NSString *cellIdentifier=@"TableViewCell";

    //tagAlloc为一个全局的BOOL类型标志

    if (!tagAlloc) {

        UINib *nib=[UINib nibWithNibName:@"TableViewCell" bundle:nil];

        [tableView registerNib:nib forCellReuseIdentifier:cellIdentifier];

        tagAlloc=YES;

    }

    

    TableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    cell.myCellTitle.text=@"asdf";

    

    return cell;

}

原文地址:https://www.cnblogs.com/howdoudo/p/3904645.html