I think I got the clue. Here you are changing value of startingScore
2 times. First you are setting its value to 500 in viewDidLoad
. Then you are changing from 500 to 5000 in -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
method. Now when you are coming back to frontpage
, the viewDidLoad
method is being called again for frontPage
. so value of startingscore
is again turning into 500. You can check it by using NSLog
function. I am pretty sure that's what happening here.
Suggestions to rectify the problem
- Initiate
startingScore
ininit
offrontPage
- Manage
startingScore
from another class.
Edit Just paste code written below in VC of your FrontPage
& remove startingScore = 500;
from your viewDidLoad
Method
- (id)init
{
if(self = [super init])
{
startingScore = 500;
}
return self;
}