Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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
Ios 在UITableViewCell中隐藏一个ImageView>;_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 在UITableViewCell中隐藏一个ImageView>;

Ios 在UITableViewCell中隐藏一个ImageView>;,ios,objective-c,uitableview,Ios,Objective C,Uitableview,在我的应用程序中,我在tableViewCell中显示来自后端的图像。 我的tableViewCell有两个图像视图,每个图像都设置了纵横比。 根据web服务响应,我需要在UITableViewCell中显示这些图像。 假设两个图像来自后端,我正在显示这两个图像。 但是,当只有一个图像来自后端时,我通过将其aspectRatio属性设置为NO来隐藏该图像 图像正在隐藏,但第二个图像的aspectRatio无法正常工作,它显示的拉伸图像错误 我正在将UITableView的UITableViewA

在我的应用程序中,我在tableViewCell中显示来自后端的图像。 我的tableViewCell有两个图像视图,每个图像都设置了纵横比。 根据web服务响应,我需要在UITableViewCell中显示这些图像。 假设两个图像来自后端,我正在显示这两个图像。 但是,当只有一个图像来自后端时,我通过将其aspectRatio属性设置为NO来隐藏该图像

图像正在隐藏,但第二个图像的aspectRatio无法正常工作,它显示的拉伸图像错误


我正在将UITableView的UITableViewAutomaticDimension属性用于行高。

如果图像显示为拉伸,则需要查看contentMode属性,而不是约束。您应该根据需要使用.aspectFit或.aspectFill。当您收到两个图像并同时显示它们时,是否存在任何问题?我已经为其设置了AspectRatio属性。然后图像将根据aspcetRatio进行调整。@HemantSabale我认为您必须检查我的答案,以便了解其共享代码可能会有所帮助。