ios - adding Cancel UIButton to UINavigation controller -


i using storyboard, added navigation bar view controller , added 2 bar buttons (in storyboard not code) navigation bar, 1 "save" button , other "cancel" button.

now want when press cancel button viewed controller disappear , previous view controller show up. code should include in action method of cancel button :

- (ibaction)cancel:(id)sender  {     // code should written here ? } 

that depends on how presented view controller in first place. if presented modally, use this:

[self dismissviewcontrolleranimated:yes completion:nil]; 

however, if pushed current view controller via navigation controller, use this:

[self.navigationcontroller popviewcontrolleranimated:yes]; 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -