ios - how can i set a View in navigation bar -
i'm building chatting application, when user logged in want present custom view contains name , profile picture made custom view put image , label constraints , set view title view in navigation controller didn't appear
custom view called navbarview: contains image , label
viewcontroller
:
let nav = navigationcontroller! let navheight = nav.navigationbar.frame.size.height let navwidth = nav.navigationbar.frame.size.width let view = navbarview () let bannerx = navwidth/2 let bannery = 0 view.frame = cgrect(x: bannerx , y: 0, width:150, height: navheight) view.label.text = "testing" view.label.image = uiimage(named: "dragon") nav.navigationbar.topitem?.titleview = view
please hide navigation bar view appear write code.
self.navigationcontroller?.setnavigationbarhidden(true, animated: true)
and show navigation bar view disappear write code
self.navigationcontroller?.setnavigationbarhidden(true, animated: true)
and please set view in storyboard or xib want display.
Comments
Post a Comment