怎样自定义一个cell  用代码实现。  有好的CODE  麻烦贴出来  谢谢    小弟刚学习这玩意,请各位高手帮帮忙   解决下这个小问题  

解决方案 »

  1.   


    如此,不分场合的要一个,你不如自己到Google上面下载一段就好了
      

  2.   

    static NSString *CellIdentifier = @"Cell";
        
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            //
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
            cell.textLabel.font = [UIFont systemFontOfSize:16];
            cell.textLabel.adjustsFontSizeToFitWidth = NO;
            UIColor * c1 = cell.detailTextLabel.textColor;
            UIColor * c2 = cell.textLabel.textColor;
            cell.textLabel.textColor = c1;
            cell.detailTextLabel.textColor = c2;
            //cell.detailTextLabel.numberOfLines = 2;
    cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
    cell.detailTextLabel.numberOfLines = 0;
            
        }
    return cell;
      

  3.   

    具体的可以看文档,其实文档中写的很明白了,一个table cell有很多元素,有文本,图片,右边的小图标等等
      

  4.   

    UITableView里面有一个协议方法 用来创建cell ,- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath在里面用代码实现  基本上就是楼上得啦 看你还想实现什么功能 比如加图片什么得 自己在去定义UIImageView
    再把它加到你的cell里面就行啦