我有一个 UIView,其中一些部分是半透明的(alpha <1.0)和其他不透明的。我想将按钮不透明作为子视图,我注意到它们也变成半透明按钮的部分,而在不透明按钮的其他部分,即使设置为 alpha = 1.0,您也看不到。
-(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];
}
按钮仍然有效,只是可见性问题。我该怎么办?