4

Am new to stack views but am trying to hide and unhide a block of nested subviews from a button in a parallel stack view. Hiding works (the targeted stack view shrinks down to one line and goes away) but when I try to unhide, the nested stack view (actually a stack of rows, each one a stack of columns) does not expand back out again. I just get one line. Code is below

import UIKit

class Grid: UIViewController {

    @IBOutlet weak var mainGrid: UIStackView!

    @IBAction func examplesPressed(sender: AnyObject) {

        UIView.animateWithDuration(0.8, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 10.0, options: UIViewAnimationOptions(), animations: { () -> Void in
            self.mainGrid.hidden =  !self.mainGrid.hidden
            }, completion: nil)

    }
}

with an image before the hide operation (pressing example)

before hiding

and what I get when I try to unhide

after attempted unhide

What might I be missing here?

drw
  • 943
  • 1
  • 10
  • 25

0 Answers0