Hello!
I've been trying to connect two xib files via their .m files but it seems that the BOOL values on one .m file doesn't respond when accessed from the other .m file
In this case I try to enable a button in the menu.m when the button end is pressed on the game.m but the BOOL value doesn't respond
this is how I did the code...
am I forgetting something?
menu.h
Code:
#import "Game.h"
@class Game;
//Pointer to the gameview
IBOutlet Game *game;
@property (nonatomic, retain) IBOutlet Game *game;
menu.m
Code:
@synthesize game:
-(IBAction)start{
NSLog(@"Start");
game = [[Game alloc] initWithNibName:@"Game" bundle: nil];
//this button shall be enabled when MSaveToContinue == YES
if(game.MSaveToContinue == YES){ //this button shall be enabled when
NSLog(@"game.MSaveToContinue == YES");
continuegame.hidden = NO;
continuegame.alpha = 1.0;
continuegame.enabled = YES;
}
else{
NSLog(@"game.MSaveToContinue == NO");
continuegame.hidden = NO;
continuegame.alpha = 0.5;
continuegame.enabled = NO;
}
back.hidden = NO;
}
game.h
Code:
BOOL MSaveToContinue;
@property (nonatomic) IBOutlet BOOL MSaveToContinue;
game.m
Code:
@synthesize MSaveToContinue;
//Saving the current gamestate
-(void)saveGameState {
MSaveToContinue == YES;
}
-(IBAction)endGame{
[self saveGameState];
}
is there another way to switch between xibs?
maybe an easier way...
from one .m file perhaps? if yes then how ?
thanks in advance