2011-07-13 52 views
0

ü建設的UIView,並把圖像作爲視圖backgrond:的UIView有UIImage的背景

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

的問題是,現在theuiview是用黑色的角落。 我作爲背景放置的圖像是圓角的。

任何解決方案?

+0

該視圖應該是autoreleased,如果它的屬性與attr。非原子,保留。 –

回答

1

將圖像編輯爲不具有圓角,或者使角落後面的空間是某種其他顏色或圖像。

你在做什麼,然後說

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

查看正在考慮

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

那麼我應該如何構建它? – MTA

+0

將實際圖片資源更改爲**不具有圓角**。 –

0
self.tmpView.opaque = NO; 

可能的幫助。