I want to put If condition on UIView. If the subView appears the button should be disabled. but i done know the syntax of how to put condition on UIView. I would be really thankful if any one can guide me. Thanks in advance.

有帮助吗?

解决方案

If your view is appear means, your view is in view's hierarchy, that means, your view's window property will be not nil, you can check with this condition.

if (view.window != nil)
{
    //button disable 
}

其他提示

i think you want your condition based on subview so you have to use subview property of view like this:

 if(yourView.subviews.count>0)

{

your code for disable button

}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top