ios - Why does navigation bar logo not display in master view -


i'm writing ios 7/8 app , want display logo in center of nav bar. started master/detail project. added code change titleview logo (see following code). logo displays on detail page not on master page (the master page title displayed). i've tried putting code in navigation controller , view controller same result. there else needs set in storyboard or navcontroller code?

    var logo = uiimage(named: "logo_sm.png")     var logoview = uiimageview(image: logo)     self.navigationitem.titleview = logoview 

or in view controller

    var logo = uiimage(named: "logo_sm.png")     var logoview = uiimageview(image: logo)     self.navigationcontroller?.navigationitem.titleview = logoview 

edit found way make work. in uiviewcontroller changed code to:

    self.navigationitem.titleview = logoview 

this references view's navigationitem rather navigation controller's navigationitem.

the first snippet works fine. think problem didn't add image inside target, guess.

enter image description here

make sure checked "add targets" option, when drag , drop image file project.

hope helps, happy coding :)


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -