Ios UIImage与她的UIImageView大小相同,但显示不相等

Ios UIImage与她的UIImageView大小相同,但显示不相等,ios,objective-c,uiimageview,uiimage,Ios,Objective C,Uiimageview,Uiimage,在我的代码中,我这样做: imageFormatos = [UIImage imageNamed:@"FondoFormatos"]; formatosImageView.frame = CGRectMake(tempFormatoX, 540, widthFormato, 230); formatosImageView.contentMode = UIViewContentModeScaleToFill; formatosImageView.layer.borderWidth=

在我的代码中,我这样做:

imageFormatos = [UIImage imageNamed:@"FondoFormatos"];
formatosImageView.frame = CGRectMake(tempFormatoX, 540, widthFormato, 230);
    formatosImageView.contentMode = UIViewContentModeScaleToFill;
    formatosImageView.layer.borderWidth=0.0;
    [imageFormatos DrawInRect:CGRectMake(formatosImageView.frame.origin.x,formatosImageView.frame.origin.y,formatosImageView.frame.size.width,formatosImageView.frame.size.height)];
formatosImageView.backgroundColor = [UIColor blueColor];
如图所示:

我设置背景以查看两个视图的大小。我需要黑色图像填充所有图像视图

编辑:确定,它有透明边界,但在Xcode文件检查器中未显示:

imageFormatos = [UIImage imageNamed:@"FondoFormatos"];
formatosImageView.frame = CGRectMake(tempFormatoX, 540, widthFormato, 230);
    formatosImageView.contentMode = UIViewContentModeScaleToFill;
    formatosImageView.layer.borderWidth=0.0;
 self.formatosImageView.image= imageFormatos;

formatosImageView.backgroundColor = [UIColor blueColor];

我已更新了您的代码,请检查一次,然后添加另一个图像并检查一次。我认为该图像具有透明边缘您可以通过在预览中打开图像进行检查,请检查图像周围是否有透明背景?formatosImageView.contentMode=UIViewContentModeScaleAspectFill;试试这个