Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何将第二个图像视图转换为tableview单元格?_Iphone_Ios_Facebook Graph Api_Uitableview_Uiimageview - Fatal编程技术网

Iphone 如何将第二个图像视图转换为tableview单元格?

Iphone 如何将第二个图像视图转换为tableview单元格?,iphone,ios,facebook-graph-api,uitableview,uiimageview,Iphone,Ios,Facebook Graph Api,Uitableview,Uiimageview,我正在实现一个应用程序,其中有两个图像需要显示在同一个tableviewcell上 然而,由于应用程序的设置方式,我无法将tableviewcell子类化。所以我想以编程方式创建一个图像视图,然后添加到cell.contentview,但结果是错误的。任何帮助都将不胜感激。我如何调整单元格高度以匹配图像您不应该将imageView直接添加到单元格视图中。您应该将其添加到其contentView中,因为contentView知道在进入编辑模式、旋转等时如何调整自身及其子视图的大小。我如何调整单元格

我正在实现一个应用程序,其中有两个图像需要显示在同一个tableviewcell上


然而,由于应用程序的设置方式,我无法将tableviewcell子类化。所以我想以编程方式创建一个图像视图,然后添加到cell.contentview,但结果是错误的。任何帮助都将不胜感激。

我如何调整单元格高度以匹配图像您不应该将imageView直接添加到单元格视图中。您应该将其添加到其contentView中,因为contentView知道在进入编辑模式、旋转等时如何调整自身及其子视图的大小。我如何调整单元格高度以匹配图像您不应该将imageView直接添加到单元格视图中。您应该将其添加到其contentView中,因为contentView知道在您进入编辑模式、旋转等时如何调整自身及其子视图的大小。
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];