YosiFZ
YosiFZ

Reputation: 7890

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 rounded corners.

any solution for this?

Upvotes: 0

Views: 169

Answers (2)

omz
omz

Reputation: 53551

self.tmpView.opaque = NO;

might help.

Upvotes: 0

Patrick Perini
Patrick Perini

Reputation: 22633

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. 

Upvotes: 1

Related Questions