IOS7中的图像背景问题

时间:2013-10-21 07:18:17

标签: iphone ios objective-c uiimageview

我在viewcontroller中添加了imageview 它在ios6中运行良好但在ios7中它以白色背景显示。

我尝试了clearColor,但它不起作用。
这是我的代码

[imgcharacter setImage:[UIImage imageNamed:[NSString stringWithFormat:@"character%d.png",reelBtnTag]]];

[imgcharacter setFrame:CGRectMake(100,100, 247.5f, 385.0f)];
imgcharacter.userInteractionEnabled=YES;
 [imgcharacter setBackground : [UIColor clearColor]];          
[captureview addSubview:imgcharacter];

1 个答案:

答案 0 :(得分:1)

试试这种方式......

NSData *imageData = UIImagePNGRepresentation(Your Image);
    UIImage *image=[UIImage imageWithData:imageData];
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 52, 40, 50)];
    imageView.backgroundColor = [UIColor clearColor];
    imageView.image = image;