It has been some months that I've programmed for iOS, and want to finish my game with new features. Now when people play the game and lose they will see a "Game Over" view.
Now what I want is that people first see a view where they can use the bought credits they gotten and go back to the game with the extra seconds or life
. But I'm not doing it on the right way.
Way I'm trying to do:
- Save Me View (Segue)
Game view -
- Game Over View (Segue)
So, you lose, go automatically to the save me
view, presses close and go to game over
immediately. Otherwise use the NSUserDefaults that has been saved before showing the Save Me
view.
So I'm using NSUserDefaults for saving previous game levels/points etc and that is not the right way of doing and the flow is getting complicated.
Second try: I've tried it but I'm stuck at the last step. Because I'm using Segue's and delegates, I don't know how to make my GameView the delegate of the SaveView, while the protocols are already there.. I've followed this: Passing Data between View Controllers
Now at step 6 it doesn't work because i'm using modal segue's with my UIViewControllers and no UINavigationControllers. I've this in my code atm:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"SaveMe"]){
SaveMeViewController *vc = [segue destinationViewController];
// Here needs to come that GameView (This Class) is the delegate for SaveMeViewController. Tried vc.delegate = self; but this doesn't work.
[self savePoints];
}
}