Greetings - I am trying to set and store values in memory... and be able to share them between classes. I've tried two different methods with not too much luck -- one with 'dot' syntax and one with [].
Generally: In class1 I have something like this:
#import <Foundation/Foundation.h>
@class Class1;
@interface Class1 : NSObject {
NSString *isTest;
}
@property(nonatomic, retain) NSString *isTest;
- (void)startTest;
@end
The .m file looks like this:
#import "Class1.h"
@implementation Class1
@synthesize isTest;
- (void)startTest {
self.isTest=@"yes this is a test";
}
So All I'm trying to do is set up a method that sets a value (isTest) when the method(startTest) is called.
Then in another class, I am trying to execute and access some of the values from Class1:
Here is the .h
#import <UIKit/UIKit.h>
#import "Class1.h"
@interface _AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UIView *view1;
Class1 *Class1Local;
}
@property (nonatomic, retain) Class1 *Class1Local;
@end
and then the .m
#import "_AppDelegate.h"
@implementation _AppDelegate
@synthesize window,view1;
@synthesize Class1Local;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// one time we want to kick off the startTest event
// this sets the isTest value
[Class1Local startTest];
NSString *dantest;
dantest=[solarDan isRegistered];
NSLog(dantest);
}
So I'm sure this is very simple..... just not for me. Any ideas on why I can't get to this value? I don't get any errors... just an empty value.
I started this a different way by using the form of id Class1Local; Class1Local = [Class1 alloc]; [Class1Local startTest]; dantest = [Class1Local isTest];
...but not much luck there either.
I'm missing one key concept -- how do I set it and then access it from another spot. I thought that the @Register in the home class did the setters and getters, and ultimately put the value into memory. I just can't seem to get my hands on a value.
I also checked for other occurrences of the same variable in case I am stopming on the value... no joy.
Any suggestions and teachings would be much appreciated for this old aspnet/sql gone objective-c guy.
thanks! Dan Ribar
Dan Ribar