I define a property in the viewcontroller A
@property (nonatomic) BOOL updateOnServer;
and also synthesize it, give it values and then I
You can always use a singleton class as follows:
Create a new class as follows:
ServerCheck.h
#import
@interface ServerCheck : NSObject
{
BOOL updateOnServer;
}
@property (nonatomic) BOOL updateOnServer;
+ (id)sharedSingletonController;
@end
ServerCheck.m
#import "ServerCheck.h"
@implementation ServerCheck
@synthesize updateOnServer
+(ServerCheck*)sharedSingletonController{
static ServerCheck *sharedSingletonController;
@synchronized(self) {
if(!sharedSingletonController){
sharedSingletonController = [[ServerCheck alloc]init];
}
}
return sharedSingletonController;
}
-(id)init{
self = [super init];
if (self != nil) {
}
return self;
}
@end
You can access the BOOL value as follows:
ServerCheck *serverData = [ServerCheck sharedSingletonController];
serverData.updateOnServer = YES;