2012-12-21 65 views
0

我有一个UIView与一些半透明的部分(alpha < 1.0)和其他不透明。我想把按钮设置为不透明的子视图,我注意到它们的部分也变成了半透明的按钮,而在不透明按钮的其他部分,即使设置为alpha = 1.0,也不能看到它们。UIView半透明按钮不可见

-(void)viewDidLoad{ 
    //...... 
    self.viewSito = [[UIView alloc]init]; 
    //this view has some parts semi-trasparent and other opaque 

    self.buttonClose =[UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    self.buttonClose.backgroundColor=[UIColor blackColor]; 
    self.buttonClose.alpha =1.0; 
/*the output is semi-transparent when is on uiview semi-transparent, but when uiview is 
    opaque the button is not visible, as if it were "hidden" from the opaque part 
    of the view.*/ 
    //... 

[self.viewSito addSubview:self.buttonClose]; 

} 

该按钮仍然有效,这只是一个可见性问题。我该怎么办?

回答

0

尝试设置你的UIView半trasparent这样:

myView.backgroundColor =的UIColor colorWithRed:0.1F绿色:.1F蓝:.1F阿尔法:.7f]。

设置阿尔法值