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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:00:23+00:00 2026-05-15T06:00:23+00:00

This question is similar to this other post , but I’m new to iPhone

  • 0

This question is similar to this other post, but I’m new to iPhone development and I’m getting used to the good practices for organizing my data throughout my app. I understand the ApplicationDelegate object to be the best place to manage data that is global to my app, correct? If so, how can I access data that’s stored in my App Delegate from various view controllers? For example, my array is created in the app delegate as such…

appdelegate.m

sectionTitles = [[NSArray alloc] initWithObjects: @"Title1", @"Title2", @"Title3", nil];
rootViewController.appDelegate = self;

and I need to access it throughout the different views of my app, like my root table view controller…

rootviewcontroller.m

NSUInteger numTableSections = [self.appDelegate.sectionTitles count];

Is this the best way to do it or are there any reasons I should organize my data a better way? I ask because I can never really get too comfortable with using global variables (I blame my college professors), though I’m not sure if this can be considered a global variable.

Thanks so much in advance for your help!

  • 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-15T06:00:25+00:00Added an answer on May 15, 2026 at 6:00 am

    I understand the ApplicationDelegate
    object to be the best place to manage
    data that is global to my app,
    correct?

    Not really (your college professors had a point). It’s tempting to start putting a lot of stuff into the app delegate, but it’s not a very sustainable practice. See my answer here.

    And read this good post by Matt Gallagher for more depth.

    That said, I often put something like this in my app delegate header:

    #define APP_DELEGATE (MyAppDelegate*) [[UIApplication sharedApplication] delegate]
    

    so I can easily do things like:

    int n = [[APP_DELEGATE sectionTitles]count];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im not sure this is a good question to post but here is my
This question is similar to this other one , with the difference that the
Similar to this question only the other way of flow. Insert Picture into SQL
I've had a look at other questions similar to this one but I couldn't
I know this is very similar to a few other questions, but I can't
This question is similar to mine, but does not contain an answer. I want
This question is similar to knockoutjs databind with jquery-ui datepicker , but instead of
(This question is similar to this one , but it's for using XMLHttpRequest instead
I swear I have poured and poured over every other similar question on this
As similar to this question (there are more related entries, however as a new

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.