Resetting a UIView

Discussion in 'iPhone/iPad Programming' started by Wellington2k, Nov 11, 2011.

  1. Wellington2k, Nov 11, 2011
    Last edited: Nov 11, 2011

    macrumors regular

    Joined:
    Jun 4, 2011
    #1
    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!
     
  2. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Code:
        UIView *view;
        [view reloadInputViews];
    No idea, but maybe that should work? :p
     
  3. macrumors regular

    nickculbertson

    Joined:
    Nov 19, 2010
    Location:
    Nashville, TN
    #3
    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
     
  4. Wellington2k, Nov 11, 2011
    Last edited: Nov 11, 2011

    thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #4
    nickculbertson you are AMAZING!!!

    Thanks SO much! :D

    I've wrestling with this all week!
     

Share This Page