2012-12-21 4 views
0

일부 반투명 (알파 < 1.0) 및 기타 불투명 한 부분이있는 UIView가 있습니다. 하위 뷰로 불투명 한 버튼을 넣기를 원한다면 반투명 버튼이되는 부분도 있지만, 불투명 버튼의 다른 부분에서는 알파 = 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]

알파 값을 설정하십시오.

관련 문제