I am making an iPhone app and want to use an 'if' statement and a boolean to set default values in some instances but not others... is this possible?
Are there alternative options if it is not possible?
EDIT: In the MainViewController.m I have:
@interface MainViewController (){
BOOL moveOver;
}
[...]
- (void)viewDidLoad
{
[super viewDidLoad];
_label.text = [NSString stringWithFormat:@"%i", computerSpeed];
}
}
[...]
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller
{
[self dismissViewControllerAnimated:YES completion:nil];
moveOver = true;
}
EDIT: The problem that it is redefined when the ViewDidLoad still persists... I need a statement that will not redefine when the ViewDidLoad runs (sorry for the unclarity)
EDIT: I have something that I feel like is much closer to working...
In the ViewDidLoad I have:
if (playToInt != 10 || computerMoveSpeed != 3) {
moveOver = TRUE;
}
which connects to my created method, gameLoop. It has
if (moveOver == false) {
computerMoveSpeed = 3;
playToInt = 10;
}
I have two UITextFields and typed 10 and 3 in them... does this not set it to the default? It seems to set the default to 0 for both, how do I change this?