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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:50:20+00:00 2026-05-24T04:50:20+00:00

I was just curious about the correct way to go about accessing a property

  • 0

I was just curious about the correct way to go about accessing a property that I have declared in a ViewController and using it in an Objective-C Class file? I have included the .h file, but that doesn’t seem to be enough. I know that I could just move it to the app delegate and access it in both places then, but there has to be a cleaner and more direct way.

Edit for clarity:

nrViewController.h:

@interface nrViewController : UIViewController {

    NSMutableArray *checkpoints;
}

@property (nonatomic, retain) NSMutableArray *checkpoints;

nrViewController.m

@implementation nrViewController
@synthesize checkpoints;

//A bunch of code, some of which actually uses checkpoints

@end

XMLParser.m:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {

    if([elementName isEqualToString:@"Checkpoints"]) {

        checkpoints = [[NSMutableArray alloc] init];

    }

This isn’t totally complete as I would like to us it in more places, but the only other place outside of XMLParser.m would be in nrViewController.m and that I understand how to do that. I would like to declare and use the checkpoints variable in nrViewController, and use it in XMLParser.m as well as I would be loading parse data into it and then manipulating it. I hope this clarifies things a bit more, but if more info is need I would be happy to explain in even more detail.

Thanks!

-Karoly

  • 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-24T04:50:21+00:00Added an answer on May 24, 2026 at 4:50 am

    To be honest, hard to follow the idea of question.

    If you declared a property and synthesized or coded getters/setters, then it should be available from the other classes as long as you’re trying to get it from object of the class, where you declared the property.

    If you want to use property as a static variable, touching just a class, not an object, then you can do that, but you should either define this variable as static global variable and work with it directly, or you should implement your custom static getter/setter methods for that property.
    Hope I didn’t get confused in some place.

    EDIT
    Observations according to the provided code:
    You didn’t declare a property, man. For your variable you should use

    @property (nonatomic, retain) NSMutableArray *checkpoints;
    

    (this is under the closing figure bracket in @interface. And in .m file you should do @synthesize checkpoints;

    (after the @implementation nrViewController { )

    Also, access your variable in the way

    yourNRViewControllerInstance.checkpoints = ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just curious about how jaxb works, I have a class annotated as follows: @XmlRootElement(name
Just curious about the encodings that system is using when handling string storing(if it
Just curious. I heard something about the new G1GC addressing that latency problem. I
Just curious about a particular scenario of NAT. Let's suppose we have 4 computers
I am just curious about @model dynamic in mvc 3. Correct me if I
Just curious about the maximum file size limit provided by some popular file systems
Just curious about the best way to go about this. I want to make
I'm just curious about this. It strikes me that the behavior of a StringBuilder
I have just become curious about how email services handle the same email sent
Just curious about this, I have one server our dev where a ridiculous amount

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.