Switching to New View and read new methods

Discussion in 'iOS Programming' started by sldice, Jan 1, 2011.

  1. sldice macrumors newbie

    Oct 24, 2010
    I was hoping someone could help me with what I think is an easy question. I am new so not everything makese sense yet.

    So to learn I am making a simple higher or lower card game. When a card ties instead of being higher or lower I want it to go to a new view. I have made that work, but I can't get anything to work in the new view.

    Because I don't understand everything yet, I have the same variables & objects in both ViewControllers. So lets say I have card1 object, randomNumber variable in my HighLowViewController.h, and I have the same in my TieViewController.h file.

    I guess my question would be are you allowed to use the same names twice if they are in separate ViewControllers? I don't get any errors, but when I go to the TieViewController it is supposed to radomize the first card (which it does fine in my first ViewController), but it does nothing which makes me feel like I can switch views but somehow I haven't connected something to read the methods in the TieVewController. I hope that makes sense.
  2. flummoxed macrumors member

    Nov 27, 2010
    Looks like a similar problem I had with an instance method not getting called.

    Did you allocate and init the variable instance in your Tie controller?
    My guess is that it is nil and not responding to messages.

    see my post called "subclass method not being called".

Share This Page