我正在实现一个应用程序,它有2个图像,我需要在同一个tableviewcell上显示。
然而,由于应用程序的设置方式,我不能将tableviewcell子类化为什么。所以我想以编程方式创建一个图像视图,然后添加到cell.contentview,但它只是出错了。任何帮助将不胜感激。
答案 0 :(得分:5)
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[imageView setFrame:CGRectMake(x,y,width,height)]; //note this is in the cell coordinate system
[cell.contentView addSubview:imageView];