简体   繁体   English

当我们发布类似Facebook的内容时,如何在“表格”视图单元格中显示完整图像

[英]How to show the full Image in Table view cell when we posted something Like Facebook

This is My Code: 这是我的代码:

cell.ImageViewPost.contentMode = UIViewContentModeScaleAspectFit;
cell.ImageViewPost.clipsToBounds = YES;
BaseURLIMG =[baseImageURl stringByAppendingString:[[ArrTotalResult valueForKey:@"post"]objectAtIndex:indexPath.row]];
[cell.ImageViewPost setImageWithURL:[NSURL URLWithString:BaseURLIMG] placeholderImage:nil];

My image is not showing as exactly cell frame. 我的图像未完全显示为单元格框架。 We need to show exactly like Facebook post, in which the posted image is showing in full view. 我们需要完全像Facebook帖子一样显示,其中发布的图片以全视图显示。

  1. Ensure that the imageViews frame is the size of the cell (or the size you want) 确保imageViews框架是单元格的大小(或所需的大小)

  2. try changing the contentMode to UIViewContentModeScaleAspectFill . 尝试将contentMode更改为UIViewContentModeScaleAspectFill If the image is still not the size you want then this will be because of the Height to width ratio of the image being different to that of the imageView so some cropping will occur. 如果图像仍然不是您想要的尺寸,则这是因为图像的高宽比与imageView的高宽比不同,因此会发生某些裁剪。 to stop this use UIViewContentModeScaleToFill , which changes the aspect ratio of the image to match the imageView, but can distort the image. 要停止此操作,请使用UIViewContentModeScaleToFill ,它可以更改图像的长宽比以匹配imageView,但可以使图像变形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM