开发者

uiview with uiimage as background

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜