Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:01:40+00:00 2026-05-13T20:01:40+00:00

I found this code to display a modal view: – (void)add:(id)sender { // Create

  • 0

I found this code to display a modal view:

- (void)add:(id)sender {
   // Create the root view controller for the navigation controller
   // The new view controller configures a Cancel and Done button for the
   // navigation bar.
   RecipeAddViewController *addController = [[RecipeAddViewController alloc]
                       initWithNibName:@"RecipeAddView" bundle:nil];
   addController.delegate = self;

   // Create the navigation controller and present it modally.
   UINavigationController *navigationController = [[UINavigationController alloc]
                             initWithRootViewController:addController];
   [self presentModalViewController:navigationController animated:YES];


   // The navigation controller is now owned by the current view controller
   // and the root view controller is owned by the navigation controller,
   // so both objects should be released to prevent over-retention.
   [navigationController release];
   [addController release];
}

My question is how do I implement this code (I’m going to place it in a buttonPress method)

Do I need to define anything in my header file? The bit that confuses me is that apple on provides this and no header file so i cant tell if anything should be there?

The code refers to RecipieAddViewController what do I repleace this with, “UIViewController” ?

What do I put as the delegate in the headerfile ? do I need to set this up anywhere else ? like with a property?

Is there anything else I need to do once I have copid this code in my buttonPress method to make it work?

Thanks and sorry for all the questions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:01:41+00:00Added an answer on May 13, 2026 at 8:01 pm

    My question is how do I implement this code (I’m going to place it in a buttonPress method)

    Define the method as an IBAction like -(IBAction)add:(id)sender and in interface builder bind a button’s touch up inside event to the view controller object’s add: action outlet.

    Do I need to define anything in my header file? The bit that confuses me is that apple on provides this and no header file so i cant tell if anything should be there?

    Nope. All this stuff needs is UIKit.h You usually need to change your header to add methods, add instance variables, or include custom classes. You may need a #import RecipeAddViewController.h somewhere (in your header or your implementation file) in order to use that class, however. This is true for any custom class you write that you want to use in another file.

    The code refers to RecipieAddViewController what do I repleace this with, “UIViewController”?

    Replace that with the view controller class you want to push. UIViewController itself is rarely useful naked. It’s made to subclassed. So you create a new class that inherits from UIViewController, import it’s header, create and instance of it, and push it on the navigation controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer dfghaefb; produces a run-time error. Those errors may be suppressed… May 16, 2026 at 4:48 pm
  • Editorial Team
    Editorial Team added an answer Somehow the search for tests that rake test does has… May 16, 2026 at 4:48 pm
  • Editorial Team
    Editorial Team added an answer It is part of the compiler/IDE. Or to be precise,… May 16, 2026 at 4:48 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using Lightbox Gone Wild to display a modal dialog with a form
I'm trying to customize a table view to display a feed of youtube videos
I have found some similar questions like this one, however there are so many
This is driving me nuts! A little piece of code that I can't seem
I want to display and rotate a single 3D model, preferably textured, on the
I want to create my very first web app using HTML, MySQL, PHP and
Is there any way to create a ViewDataDictionary with a model and additional properties
For some reason I have to initialize the ListBox items in behind code, the
I have the following HTML (excerpt from larger code-base) <div class=diary-event ui-corner-all title=[title]> <span
I'm trying to consume an ASP.net Web service, and found a utility called WSDL2ObjC.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.