ios - How to change TabBar items Navigation Title -
i'm facing problem ! have been struggling days ! problem i'm not able change title of navigation in tabbar items.
first i'm pushing uitabbarviewcontroller app delegate if user signed in.
let currentuser = pfuser.currentuser() if currentuser != nil { let mainstoryboardipad : uistoryboard = uistoryboard(name: "main", bundle: nil) let homeview : uiviewcontroller = mainstoryboardipad.instantiateviewcontrollerwithidentifier("4") let navigationcontroller = application.windows[0].rootviewcontroller as! uinavigationcontroller navigationcontroller.pushviewcontroller(homeview, animated: false) } else { }
then in first item viewcontroller i'm using change titleview image example.
let logo = uiimage(named: "logo.png") let imageview = uiimageview(image:logo) self.navigationcontroller!.topviewcontroller!.navigationitem.titleview = imageview
and in second item viewcontroller i'm using change title again.
self.navigationcontroller!.topviewcontroller!.navigationitem.titleview = nil self.navigationcontroller!.topviewcontroller!.navigationitem.title = "second"
but when go first item should see image set, instead see title of second item view controller
replace
self.navigationcontroller!.topviewcontroller!.title = "mes contacts"
with
self.navigationcontroller!.topviewcontroller!.navigationitem.title = "mes contacts"
Comments
Post a Comment