【问题标题】:Buttons on UIView semitransparent are not visibleUIView 半透明上的按钮不可见
【发布时间】:2012-12-21 14:03:08
【问题描述】:

我有一个 UIView,其中一些部分是半透明的(alpha

-(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];

}

按钮还能用,只是能见度的问题。怎么办?

【问题讨论】:

    标签: uiview uibutton subview alpha


    【解决方案1】:

    尝试以这种方式将您的 UIView 设置为半透明:

    myView.backgroundColor = [UIColor colorWithRed:0.1f green:.1f blue:.1f alpha:.7f];

    设置 alpha 值

    【讨论】:

      猜你喜欢
      • 2013-03-22
      • 1970-01-01
      • 1970-01-01
      • 2015-11-19
      • 2011-09-15
      • 2011-09-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-10
      相关资源
      最近更新 更多