How to add images to UITableView cell?

后端 未结 5 1374
暖寄归人
暖寄归人 2021-02-09 16:57

I temporarly added some values to the UITableViewCell programmatically. But I need to add images to each cell. How can I do that?

Here is my code. .h file

5条回答
  •  攒了一身酷
    2021-02-09 17:21

    You can add images using the imageView property of a cell:

    cell.imageView.image = [UIImage imageNamed:@"user.jpg"];
    

    in your - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method.

提交回复
热议问题