swift - Adjust position of bar button item when using large titles with iOS 11 -
i using large title navbar ios 11, when add bar button item looks weird positioned in same location original title navbar. move bar button item down when title large, , move original position when navbar no longer large. best way of doing this?
this image showing weird position of bar button item
i can navbar height dynamically using viewwilllayoutsubviews(), can't change position of bar button item using settitlepositionadjustment
override func viewwilllayoutsubviews() { guard let navbarheight = self.navigationcontroller?.navigationbar.frame.height else{ return } }
what want set title position adjustments of barbuttonitem
. add following line viewwillappear
func. play vertical
, horizontal
value layout
of ur liking.
navigationitem.rightbarbuttonitem?.settitlepositionadjustment(.init(horizontal: 10, vertical: 20), for: uibarmetrics.default)
https://developer.apple.com/documentation/uikit/uibarbuttonitem/1617149-settitlepositionadjustment
Comments
Post a Comment