Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Wellington2k

macrumors regular
Original poster
Jun 4, 2011
131
0
Hello.

I have a ViewController (Menu) that then switches to a UIView (Level_1).
When you die in the UIView (Level_1) it then switches to another UIView (Loss of life animation) and then switches back to Level_1.

Now the problem. I can't get into detail, but it is a major issue and it only happens when I switch back to the UIView (Level_1).
The only possible way to fix it would be to reset the UIView (Level_1) to its original state when you switch from Loss of life animation.

I have already tried resetting all the variables, but it doesn't help.
Is there a code to reset everything in a UIView?

Thanks!
 
Last edited:
I have already tried resetting all the variables, but it doesn't help.

This should work. How did you attempt this? Did you reset your variables before you changed views?

Or, you could just have your "life loss" view merged with your "Level_1" view as hidden layers and reset you variables there.

Code:
//image1 is a UIImage
-(IBAction)dead{
deadmenu.image=image1;
deadmenu.hidden=NO;
//reset variables here  
}
-(IBAction)nextlife{
deadmenu.hidden=YES;
deadmenu.image=nil;
//set this imageview to nil when you are not using it and it won't use up any unwanted memory
}

Nick
 
nickculbertson you are AMAZING!!!

Thanks SO much! :D

I've wrestling with this all week!
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.