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 6141943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:19:11+00:00 2026-05-23T18:19:11+00:00

Still really new to iOS dev (have a background in asp.net / web), and

  • 0

Still really new to iOS dev (have a background in asp.net / web), and I don’t think I’ve quite gotten my head around how everything relates to everything else. For example, I’m building an app at the moment which starts with a NavigationController. I’m passing ViewControllers in and out of that quite happily and everything is working but now I need to add a rightbutton to the navigation controller. I have done this from within one of the ViewControllers like this:

- (void)viewDidLoad
{
UIBarButtonItem *change = [[UIBarButtonItem alloc] initWithTitle:@"CHANGE" style:UIBarButtonItemStylePlain target:self action:@selector(navAlert)];

self.navigationItem.rightBarButtonItem = change;

[change release];

[super viewDidLoad];
}

 - (void)navAlert
{

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"nav pressed" message:@"You pressed the Change button" delegate:nil cancelButtonTitle:@"Yep" otherButtonTitles:nil];

[alert show];
[alert release];
}

but I don’t want to have to do that in each controller – should something like this go into the AppDelegate and be called from there?

Also, suppose I didn’t want to start with a NavigationController – could I use code in the AppDelegate to release ViewControllers and load new ones directly into the Window, by clicking a button which is set up in a ViewController?

Sorry if this is a bit of a stupid question, but I don’t think I’ve quite grasped how the different layers relate, what code is available to which controller, etc.

Thanks

  • 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-23T18:19:12+00:00Added an answer on May 23, 2026 at 6:19 pm

    You should not put interface related code inside the appdelegate. That’s what the ViewControllers are there for. If there’s functionality which is common to all of your viewcontrollers, I’d suggest subclassing UIViewController (and then deriving all other instances from this subclass) or writing a category on it.

    The appdelegate on the other hand is a good place to trigger basic events tied to the lifespan of the app, like setting up core data contexts or saving the application state when it is about to enter the background.

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

Sidebar

Related Questions

im really new to ASP.Net and still havnt got my head round most of
I'm really new to .NET, and I still didn't get the hang about how
I recently switched over to a MacBook Pro so I'm still really new at
I've read several questions here concerning Tomcat and logging but I still really don't
I've tried using source control for a couple projects but still don't really understand
I am still really new to SQL functions. I am trying to figure out
In my ASP.NET MVC 3 app I have the pager enabled on my jqGrid,
I am really new to Unit testing, and I have the following really basic
Really hoping to get this finished up, and sadly I don't have enough experience
I'm really new to the WebControl / CompositeControl world, and I have a small

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.