Tuesday, May 26, 2026
HomeiOS Developmentios - VC.isHidden = true not working as anticipated

ios – VC.isHidden = true not working as anticipated

[ad_1]

I’ve a Viewcontroller ThirdViewControllerPassenger which has a number of subviews on it, together with a UICollectionView known as collectionViewwith horizontally scrolling Playing cards. To this point, so good. I’ve written code to be executed from a faucet motion from contained in the uicollectionviewcells. Tapping the motion does work and prints to console. Nevertheless, by urgent certainly one of these playing cards I wish to disguise the entire UICollectionView. I’ve arrange an onTap Operate as proven right here:

@objc func onTap(_ gesture: UIGestureRecognizer) {
    if (gesture.state == .ended) {
        /* motion */
        if favCoordinate.latitude == 1.0 && favCoordinate.longitude == 1.0 {
            //There was an error OR the Consumer has pressed the brand new Handle button
            
            //do
        }else{
            ThirdViewControllerPassenger().collectionView.isHidden = true
            if ThirdViewControllerPassenger().collectionView.isHidden == true {
                print("achieved!")
            }
        }
    }
}

As you’ll be able to see, I’ve already been troubleshooting a bit. I’ve examined ThirdViewControllerPassenger().collectionView.isHidden = true from ThirdViewControllerPassenger immediately, which labored. It doesn’t work, nonetheless, from a cell. The “achieved!” print by no means will get printed to console, so the decision by no means arrives. I ponder why or what I’m doing unsuitable.
Do not thoughts the primary if assertion, that perform isn’t written but. That ought to not matter. I’m guessing that the remainder of my code wouldn’t result in any extra clues.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments