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

largetitlenavbar

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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -