Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using someviewinsidestack.hidden = true #35

Open
GlaucoNeves opened this issue Sep 10, 2015 · 3 comments
Open

Crash when using someviewinsidestack.hidden = true #35

GlaucoNeves opened this issue Sep 10, 2015 · 3 comments

Comments

@GlaucoNeves
Copy link

I'm getting a crash when I'm trying to hide some of my views from the stack. I tried to remove two different views from my stack, one that doesn't have constraints inside, and another that does. The first one hides normally, the second one causes my application to crash. I'm using SnapKit to set contraints and I'm still using Swift 1.2.

I don't have time to provide more details now. Later today I'm going to try to reproduce this error in the demo app, then I'll post an update.

Thanks.

@tomvanzummeren
Copy link
Owner

What version of TZStackView are you using? And can you send me a report of the crash?

@GlaucoNeves
Copy link
Author

I'm using the 1.0.0 version.

I created a repository with the code that reproduces the issue: https://github.com/GlaucoNeves/TZStackViewIssue

I also tried the same code in Xcode 7 using the UIStackView and the vertical constraints in my custom view conflict, then the iOS break one of them and can continue without crash the app.

The crash report (you need to change the extension to .crash): tzstackviewissuecrashreport

@u10int
Copy link
Contributor

u10int commented Oct 27, 2015

@GlaucoNeves I was seeing a similar issue due to AutoLayout constraint errors/conflicts when hiding an auto-height view with top and bottom constraints relative its subviews. I worked around this issue by storing a reference to the bottom layout constraint, then removing or adding it based on the view's hidden value:

override var hidden: Bool {
    didSet {
        // need to remove bottom constraint for auto-height layout else we'll get AutoLayout errors
        bottomLayoutConstraint?.active = !hidden
    }
}
private var bottomLayoutConstraint: NSLayoutConstraint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants