ios - backBarButtonItem in navigation controller not showing up -
i started xcode project navigationviewcontroller template. , now, when push view, view comes edit button default , no bar button. have commented out editbutton code , corresponding setediting delegate method. can not button show up. doing wrong?
pushing new view:
playlistviewcontroller *playlistviewcontroller = [[playlistviewcontroller alloc] init]; playlistviewcontroller.managedobjectcontext = self.managedobjectcontext; [self.navigationcontroller pushviewcontroller:playlistviewcontroller animated:yes]; [playlistviewcontroller release];
in playlistviewcontroller:
- (void)viewdidload { [super viewdidload]; self.title = @""; // self.navigationitem.leftbarbuttonitem = self.editbuttonitem; // doesn't matter if here or not self.navigationitem.hidesbackbutton = false; uibarbuttonitem *addbutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action:@selector(insertnewobject)]; self.navigationitem.rightbarbuttonitem = addbutton; [addbutton release]; }
when tell uinavigationcontroller pushviewcontroller, automatically sets navigationitem.leftbarbuttonitem button title of previous uiviewcontroller's title.
if no title set, default text "back".
if title set "", no button display @ all.
self.title = @"";
try changing text , button should match text set here.
or can manually override text of leftbarbuttonitem new uiviewcontroller.
Comments
Post a Comment