Positioning the imageView of a UITableViewCell

前端 未结 6 1302
走了就别回头了
走了就别回头了 2020-12-16 13:53

In every UITableViewCell of a UITableView I\'m placing an image in its imageView. However, if I increase the height of a cell using tableView:heightForRowAtIndexPath: to acc

6条回答
  •  青春惊慌失措
    2020-12-16 14:46

    Another way (works in iOS 6) is to create a UIImageView and add it to the cell as a subview

     UIImageView *yourImageView = [[UIImageView alloc] initWithFrame:CGRectMake(x,y,20,20)];
    
    [yourImageView setImage:[UIImage imageNamed:[imagesArray objectAtIndex:indexPath.row]]]; //You can have an Array with the name of 
    
    [yourcell.contentView addSubview:yourImageView]; //add the imageView as a subview
    

提交回复
热议问题