0

I am developing a science game for the iPad that lets you choose a level and some questions about science elements are displayed and the user must choose the correct answer. I use a UITableview to display the "level select" screen and once the user selects the level the didSelectRowAtIndexPath sets an int currentLevel on the "game screen".

After the level is completed I want to create an UIButton so that the user can go to the next level without going back to the "level Select" screen (UITableView). Essentially I want to reload the view and set the int currentLevel to display the correct level for the game

Any help would be appreciated

Krueger
  • 484
  • 1
  • 5
  • 20
Johan de Klerk
  • 2,515
  • 3
  • 25
  • 35

1 Answers1

0

You can alloc your level selector view controller and present it modally in current view.

UIViewController *levelPicker = [[UIViewController alloc]init];
[self presentModalViewController:levelPicker animated:YES];
[levelPicker release];
Moonkid
  • 881
  • 7
  • 17
  • Thanks for the response but I don't want to show the level select view again, I just want a button to go to the next level – Johan de Klerk Jul 30 '12 at 08:25
  • You use a different UIViewController for each level? – Cosmin Jul 30 '12 at 08:28
  • That isn't efficient because that means I must have 10 separate UIViewControllers each with the same code. Thanks for the suggestion – Johan de Klerk Jul 30 '12 at 08:33
  • No, I was just asking, it wasn't a suggestion :D. My suggestion is to create a new view controller and present it when you press the next level button. And you pass to your new view controller the next level number in your init method. – Cosmin Jul 30 '12 at 08:40
  • I think you need method wich will reload full view according to currentLevel var. When button pressed make currentLevel++ and reloadView... – Moonkid Jul 30 '12 at 09:24