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

How to fix UIToolbar Auto Layout issues #538

Open
onmyway133 opened this issue Dec 11, 2019 · 0 comments
Open

How to fix UIToolbar Auto Layout issues #538

onmyway133 opened this issue Dec 11, 2019 · 0 comments
Labels

Comments

@onmyway133
Copy link
Owner

onmyway133 commented Dec 11, 2019

Hierarchy

UIToolbar -> _UIToolbarContentView -> _UIButtonBarStackVie

UIToolbarContentView

_UIToolbarContentView's width should equal 0
_UIToolbarContentView's height should equal 0

Workaround that fixes 1 warning

toolbar.setItems(items, animated: false)
toolbar.updateConstraintsIfNeeded()

Set frame explicitly

Use a non .zero frame that is close to the view bounds width

let toolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: 375, height: 30))
DispatchQueue.main.async {
    self.toolbar.updateConstraintsIfNeeded()
}
@onmyway133 onmyway133 added the iOS label Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant