How should I addSubview to cell.contentView?

后端 未结 2 2090
故里飘歌
故里飘歌 2021-01-30 18:09

A (when the cell is newly created):

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    static NSString         


        
2条回答
  •  忘掉有多难
    2021-01-30 18:31

    It's all about performance. With A, you reuse the cell with all of its subviews, with B, you reuse only the raw cell and add a new subview every iteration, which IMHO is not as good as A re: performance.

    I say either create a UITableView subclass or use solution A.

提交回复
热议问题