Hello,
Here is a simple one for you guys . I'm defining a class to store variables in so I can reuse those variables in different ViewControllers .
Here is how I do it, it`s obviously not working ( that's why I'm asking a question ... ):
I declare a class :
VariableStore.h
@interface VariableStore : NSObject {
int evTe;
}
@property (nonatomic) int evTe;
+ (VariableStore *)shareInstance;
@end
VariableStore.m
@implementation VariableStore
@synthesize evTe;
+ (VariableStore *)sharedInstance {
static VariableStore *myInstance = nil;
return myInstance;
}
@end
Now in my FirstViewController I want to set the value for evTe :
[[VariableStore sharedInstance] setEvte:2];
NSLog(@"value testing, %i", evTe);
And this keeps on returning 0 unfortunately, Im obviously missing something important here but I can't figure out what it is .
Later on I
d like to set the value for evTe here in the FirstViewController and then reuse it back in the SecondViewController ..