Tuesday, 15 June 2010

iOS Storyboard clobbering variables when pushing scenes? Why? How should it be done? -


I have storyboard configurations in my iOS project.

Storyboard 1-> NavController-sceneA-> Storyboard 2 / Starboard 2-> Visual B-> Sense C

-> A "Show" Segue View Loads a Storyboard And pushes it to your navigation controller.

Ul>
  • In Visual A there is a controller which is an example X.
  • Visual B uses the default UIViewControoler class.
  • There is a controller in the SceneC which is Y Y.
  • Both the implementations of the sections are as follows:

      // ClassX.h // @interface ClassX: UITableViewController //ClassX.m// @ Implementation Class X NSArray * model; // .. @end //ClassY.h// @ Interface Classwi: UITWebCentroler // ClassWai.MAR @ Implementation Classware NSARRA * Model; The problem is that when I try to load the view C, it tries to use a field called "model" in the implementation - but the area of ​​the model is found for some reason why it is for visual A and How should I correct it?  

    You should model the class of property instead of declare them as you do. They are probably making global variables

    then either:

      @implementation {NSArray * models}: Or to ensure that they are variables that are part of the class Are there. .. @end  

    or use better personal properties and use the code self.model .:

    then in class. Try it:

      @ interface class Y () @ property NSArray * model; @end @implementation ClassY ... @end  

    Do this for ClassX.


    No comments:

    Post a Comment