简体   繁体   中英

How to set condition on UIView

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM