Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
NSDate value set in one method, is inaccessible from another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDate value set in one method, is inaccessible from another



Am sorry to ask such a trivial question. Am a newbie to Objective-C, & simply cannot see how to get this working, after having tried several possible ways & google'd around for it. Please help!
My question is simple. I have a class-level NSDate object, which is declared outside any method in the class as:

    NSDate *fromDate;

Now, within a method, am setting this value to the date from a DatePicker as:

    fromDate = [datePicker date];

Soon after the above assignment, I print its value into the log & it works fine.

    NSLog(@"From Date: %@", fromDate);
 
Now, when I use NSDate's value in another/different method, the value's gone! Why is it not persisted across methods in the same class itself? What can I do for the value to be accessible across methods? 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.