iphone - Questions while using presentModalViewController -
in application, tried use function [self.navigationcotroller presentmodalviewcontroller:nextvc animated:yes]; however, when goes next view, subview fulfill whole screen(of course did) , question , how add bar button lead view back?
i have tried use
self.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc]initwithtitle:@"back" style:uibarbuttonitemstyledone target:self action:@selector(go)];
in function viewdidload, did not work, there's no bar or button showed
uinavigationbar *bb = [[uinavigationbar alloc]initwithframe:cgrectmake(0, 0, [uiscreen mainscreen].bounds.size.width, 44)]; self.nvbar = bb; [self.view addsubview:bb];
however, have no idea how add barbutton new navigationbar ---nvbar
would give me solution?
you need pop new view controller in order navigation bar automatically included.
in view controller code above in,
//*** hook 4 buttons these actions , play around //*** better sense of going on. //*** jsbviewcontroller name of test class //*** should use viewcontroller class coding //*** can see difference of pop/push versus present/dismiss inside of //*** navigation controller -(ibaction)push:(id)sender { jsbviewcontroller * viewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:nsstringfromclass([jsbviewcontroller class])]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; } -(ibaction)pop:(id)sender { [self.navigationcontroller popviewcontrolleranimated:yes]; } -(ibaction)present:(id)sender { jsbviewcontroller * viewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:nsstringfromclass([jsbviewcontroller class])]; [self presentviewcontroller:viewcontroller animated:yes completion:nil]; } -(ibaction)dismiss:(id)sender { [self dismissviewcontrolleranimated:yes completion:nil]; }
for behavior looking for, need use push method
[self.navigationcontroller pushviewcontroller:viewcontroller animated:yes];
Comments
Post a Comment