【问题标题】:Cant add new uiview with alpha:1.0无法使用 alpha:1.0 添加新的 uiview
【发布时间】:2013-09-28 00:37:00
【问题描述】:

我想用 alpha:1.0 将 UIView 作为子视图添加到 self.view。

我正在分配 self.view.alpha = 0.5 在添加子视图之前。

当我将此子视图添加到 self.view 时,它也会获得我不想要的 alpha:0.5。 我想用 alpha:1.0 添加子视图。

所以请帮帮我....

【问题讨论】:

标签: uiview io alpha


【解决方案1】:
//---------------------
//Parent view

 [self.view setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]];

//Subview

 [sview setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:1.0]];

//--------------------

  UIView *view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.6];

不一样:

 UIView *view.backgroundColor=[UIColor blackColor];    
 view.alpha=.6;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-23
    • 2011-09-06
    相关资源
    最近更新 更多