2011-10-10 42 views
0

我有一种观点,我为自己做了并且四舍五入。当我尝试调整backgroundColor属性时,我最终将背景颜色视为正方形,不尊重我的圆角。背景颜色调整为圆角视图

有没有解决方案?

在此先感谢。

+0

当你说你自己做了圆角 - 你是怎么做到的? –

+0

使用一些QuartzCore方法。 'cornerRadius'和'setClipsToBounds'属性。 – Matoe

回答

0

试试这个代码一次。

self.settingsView.frame=CGRectMake(18, 73, 284, 210); 
[self.settingsView setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.1]]; 
[self.settingsView setClipsToBounds:YES]; 
//Enable maskstobound so that corner radius would work. 
[self.settingsView.layer setMasksToBounds:YES]; 
//Set the corner radius 
[self.settingsView.layer setCornerRadius:10.0]; 
//Set the border color 
[self.settingsView.layer setBorderColor:[[UIColor whiteColor] CGColor]]; 
//Set the image border`enter code here` 
[self.settingsView.layer setBorderWidth:2.0];