简体   繁体   English

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

[英]UIImage the same size as her UIImageView but not shown equal

In my code, I make this: 在我的代码中,我这样做:

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];

And shown like this: 并显示如下:

在此处输入图片说明

I set background to see the size of 2 views. 我设置背景以查看2个视图的大小。 I need the black image fill all imageView. 我需要黑色图像填充所有imageView。

Edit: Ok, it have transparent bounds, but in Xcode file inspector not shown: 编辑:好的,它具有透明范围,但是在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];

I have updated your code, check once 我已更新您的代码,请检查一次

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

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