Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use autolayout constraints to set size of custom bar button item
This fixes an issue where the frame for the custom view can be set to the incorrect y-offset upon setting the custom frame. In iOS 11, this behavior changed, as UIBarButtonItem went from being using springs-and-struts for sizing, to using a UIStackView, and thus using Autolayout. This lead to the superview of having a frame of (0, 22, 0, 0) at the first layout pass. By moving to using NSLayoutConstaints, we can now properly size our custom view. See also: https://gist.github.com/niw/569b49648fcab22124e1d12c195fe595 See also: https://stackoverflow.com/questions/10988918/change-width-of-a-uibarbuttonitem-in-a-uinavigationbar
- Loading branch information