UIImage与她的UIImageView大小相同,但没有显示相同

时间:2014-09-30 09:58:49

标签: ios objective-c uiimageview uiimage

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

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

并显示如下:

enter image description here

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

编辑:好的,它有透明边界,但在Xcode文件检查器中没有显示:

enter image description here

1 个答案:

答案 0 :(得分:0)

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

我已更新您的代码,请检查一次