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

A way to safely remove a arranged subView #76

Open
swapnil-sankla opened this issue Apr 6, 2016 · 2 comments
Open

A way to safely remove a arranged subView #76

swapnil-sankla opened this issue Apr 6, 2016 · 2 comments

Comments

@swapnil-sankla
Copy link

The current implementation of removing arrangedSubView is not great because even after removing arranged subView the view is still present. Remove arrangedSubView should work as expected.

A bonus would be if we can remove all the arrangedSubViews together. Some thing like -

@objc func removeAllArrangedSubViews() { for arrangedSubView in arrangedSubviews { removeArrangedSubview(arrangedSubView) arrangedSubView.removeFromSuperview() } updateConstraints() }

@andrebraga
Copy link

The official UIStackView does not behave like that.

"This method removes the provided view from the stack’s arrangedSubviews array. The view’s position and size will no longer be managed by the stack view. However, this method does not remove the provided view from the stack’s subviews array; therefore, the view is still displayed as part of the view hierarchy."

@warpling
Copy link

Interesting, at least the animation is still preserved!

    [stack removeArrangedSubview:subview];
    [subview removeFromSuperview];
    // Still animates out nicely!

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