在xcode中设置alpha背景图像iphone应用程序

我懂了:
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png" ]];
和一些其他东西,如文本字段和一个视图上的东西。 我想设置背景图像alpha,这样它就不会分散注意力。 但当我这样做时:
self.view.alpha
它为所有对象设置:-( 并且没有:
self.view.backgroundcolor.alpha
任何的想法?     
已邀请:
我把它解决了,所以你不需要2个单独的视图。
    // Make sure your whole view is NOT transparent
    self.view.alpha = 1.0f;
    // Use UIColor to set alpha transparency of just the background view
    self.view.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f];
瞧!     
这就是它的工作原理。要达到您想要的效果,您需要两个单独的视图,一个仅包含背景(并且具有
alpha
集),一个具有透明背景,
alpha
为1.0,其中包含其他控件。     

要回复问题请先登录注册