Question

I have a viewcontroller in my storyboard that is a game. I have added a restart button and linked it to the same viewcontroller so that when the player dies they can click that and the game will start all over again. My problem is that when you click it and it restarts the game starts glitching. Any suggestions or solutions. I cant use a unwind seague so what should I do.

Was it helpful?

Solution

It really depends on your code, specifically in your viewDidLoad.

Create an IBAction for that restart button in your view's class files.

For the IBAction method in your .m file, try each of these different lines of code:

[super viewDidLoad];

,

[self.view setNeedsDisplay];

, or

[self.view setNeedsLayout];

Let me know if it works, or if you have any questions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top