ios - leftbarbuttonitem does not show up in the navigation bar -


i've been developing ios app , have been having issues using image left bar button item in navigation bar. have attempted in following ways:

uiimage *backbuttonimage = [uiimage imagenamed:@"backbuttoncb"]; cgrect buttonframe = cgrectmake(0, 0, backbuttonimage.size.width, backbuttonimage.size.height); uibutton *backbutton = [[uibutton alloc] initwithframe:buttonframe]; [backbutton setimage:backbuttonimage forstate:uicontrolstatenormal]; uibarbuttonitem *backbarbuttonitem= [[uibarbuttonitem alloc] initwithcustomview: backbutton]; self.navigationitem.leftbarbuttonitem = backbarbuttonitem; 

the bar button never seems display while running app.

i proceeded try other method follows.

self.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithimage:[uiimage imagenamed:@"backbuttoncb"] style:uibarbuttonitemstyleplain target:nil action:@selector(methodname)]; 

this method worked. however, image displayed tinted blue , did not meant to. changing tint colour of image did not help.

any idea how can solve problem?

edit: more information, if helps. first view in navigation stack. navigation stack displayed modally i.e. there previous view controller , there modal segue between previous view controller , navigation controller. first view in navigation stack.

edit: problem fixed. think bug in xcode because when restarted xcode , tested actual device instead of emulator, worked fine. however, still doesn't seem work on emulator.

try setting leftbarbuttonitem way. while presenting modally doesn't shows up.

self.navigationcontroller?.navigationbar.topitem.leftbarbuttonitem =


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -