当前位置: 动力学知识库 > 问答 > 编程问答 >

ios setting alpha to all objects on view

问题描述:

In iOS 4.0.2, I would like to set the alpha to 0.00 for each object on the view that I has a tag of 100.

 (id object in [self.view subviews])

{

if ([object tag] == 100)

{

//what goes here ...

}

}

网友答案:
[self.view viewWithTag:100].alpha = 0.0;

There's no need to set the alpha of all views. The alpha applies cumulatively to all subviews. So the whole tree starting at that view will become invisible.

Makes more sense to do this usually, rather than set the alpha to 0:

[self.view viewWithTag:100].hidden = YES;
分享给朋友:
您可能感兴趣的文章:
随机阅读: