cellview中的xib注册

来源:互联网 发布:在线html源码查看 编辑:程序博客网 时间:2024/06/07 01:18
  1. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{  
  2.     
  3.     static BOOL nibsRegistered = NO;  
  4.     if (!nibsRegistered) {  
  5.         UINib *nib = [UINib nibWithNibName:@"CellView" bundle:nil];  
  6.         [tableView registerNib:nib forCellReuseIdentifier:@"CellView"];  
  7.         nibsRegistered = YES;  
  8.     }      
  9.       
  10.       
  11.     CellView *mycell=[tableView dequeueReusableCellWithIdentifier:@"CellView"];  
  12.       
  13.     mycell.index_lb.text=[NSString stringWithFormat:@"%d", [indexPath row]];  
  14.     mycell.name_lb.text=[dataList objectAtIndex:[indexPath row]];  
  15.     //mycell.textLabel.text=@"nofeng";  
  16.     return mycell;  
  17. }