Apply back action to uiButton


I need to have a UIButton (with a class of RtnBtn) which basically replicates the back button action used in the navigation bar action at the end of a process - I'm fairly new to IOS dev and I'm not sure how to approach this - should it be done via a push or is there a better option to apply coded action directly to the button?


Can you post some code here, what you have done?, you can add custom back button by below code,

UIButton *buttonBack = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonBack setBackgroundImage:YOURImage forState:UIControlStateNormal]; [buttonBack addTarget:self action:@selector(backPressed) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backButton = [[[UIBarButtonItem alloc] initWithCustomView:buttonBack] autorelease]; self.navigationItem.leftBarButtonItem = backButton;

Method to handle event,

-(void)backPressed { [self.navigationController popViewControllerAnimated:YES]; }


You need to create the button, specify a selector as it's action, and in that method call popViewController:animated: on your navigation controller.


If I did not understand wrong, you need this;

[self.navigationController popViewControllerAnimated:YES];


  • Store an image in MongoDB using Node.js/Express and Mongoose
  • I need opacity (transparency) for a img with css ie8
  • Insert a image in UINavigationBar instead of text
  • How to use ControlPaint.DrawGrid To Draw To a PictureBox
  • Appearance proxy affected by upgrade to iOS 6
  • Change UIbutton Image on click
  • Changing background image on button click android app development
  • IOS Custom UIBarbuttonItem change position in detail view
  • UItableView Replacing Checkmarks with UIButton
  • How to remove duplicate buttons
  • a concept similar to pointers in as3?
  • LibGdx GLES2.0 cube texel stretching
  • Aligning image on right side of title on UIButton with imageEdgeInsets and titleEdgeInsets
  • custom string delimiters stringtemplate-4
  • Reduction and collapse clauses in OMP have some confusing points
  • Unable to decode certificate at client new X509Certificate2()
  • How do I access an unhandled exception in an MVC Error view?
  • How to change the font size of a single index for UISegmentedControl?
  • MongoDb aggregation
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • Google Custom Search with transparent background
  • NHibernate Validation Localization with S#arp Architecture
  • Bug in WPF DataGrid
  • vba code to select only visible cells in specific column except heading
  • Redux, normalised entities and lodash merge
  • WPF Applying a trigger on binding failure
  • Acquiring multiple attributes from .xml file in c#
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • how does django model after text[] in postgresql [duplicate]
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Memory offsets in inline assembly
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • UserPrincipal.Current returns apppool on IIS
  • To Get the radio button value in ruby on rails
  • java string with new operator and a literal
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize