开发者

uiview with uiimage as background

开发者 https://www.devze.com 2023-03-20 14:26 出处:网络
u build an UIView and put an image as the view backgrond: self.tmpView = [[UIView alloc] initWithFrame:CGRectMake(20, 70, 280, 295)];

u build an UIView and put an image as the view backgrond:

self.tmpView = [[UIView alloc] initWithFrame:CGRectMake(20, 70, 280, 295)];  
self.tmpView.backgroundColor = [UIColor yellowColor];

self.tmpView.backgroundColor = [UIColor clearColor];
self.tmpView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"CloseUPPicBG.png"]]; 

the problem is that theuiview is now with corners in black color. the image that i put as backgrond is with roun开发者_如何学运维ded corners.

any solution for this?


Edit the image to not have rounded corners, or so that the space behind the corners is some other color or image.

What you're doing is saying

View, be yellow.
View, be clear. What's behind you? Nothing. Ok, be black.
View, fill yourself with this image.

View is then thinking

Hmm... there's transparency in this image.
Guess I should show whatever's behind me. Which is nothing... So black. 


self.tmpView.opaque = NO;

might help.

0

精彩评论

暂无评论...
验证码 换一张
取 消