bobbyali / kidzvids2

Second attempt at the kid-friendly Youtube iOS player
1 stars 2 forks source link

Rotations broken again #35

Open bobbyali opened 9 years ago

bobbyali commented 9 years ago

I want to fix orientation in the EAIntroView to Portrait only (because it's buggy in Landscape), but it's not working. I have this code in the Grid VC but it's not helping. self.inIntro is set to true when in the EAIntroView, and false when it finishes.

    override func shouldAutorotate() -> Bool {
        println("checking rotations...")
        if self.inIntro {
            return false
        } else {
            return true
        }
    }

    override func supportedInterfaceOrientations() -> Int {
        println("rotations...")
        if self.inIntro {
            return Int(UIInterfaceOrientationMask.Portrait.rawValue)
        } else {
            return Int(UIInterfaceOrientationMask.All.rawValue)
        }
    }    

Any thoughts?

bobbyali commented 9 years ago

The function supportedInterfaceOrientations() only appears to be called when the VC first loads, when inIntro is set to false as a default value. Can't figure out a way to update it after the VC has already loaded.

But even when I remove the conditional and use this code, it doesn't stop rotations from being changed.

    override func shouldAutorotate() -> Bool {
        println("checking rotations...")
        return false
    }

    override func supportedInterfaceOrientations() -> Int {
        println("rotations...")
        return Int(UIInterfaceOrientationMask.Portrait.rawValue)        
    }   
bobbyali commented 9 years ago

Conflict somewhere. Put introview into a separate view.