Search Results

Search found 1 results on 1 pages for 'user743550'.

Page 1/1 | 1 

  • iOS5: Confusion with loadview and init and instance variables

    - by user743550
    I'm new to iOS5 and storyboarding. I noticed that if I declare an instance variables inside my viewcontroller .h file and set the values inside my init of .m file of my viewcontroller, whe the view of the viewcontroller is displayed, my instance variables show null inside viewDidLoad. In order for me to get myvariables, I'd need to do [self init] inside viewDidLoad. My questions are: @interface tableViewController : UITableViewController { NSMutableArray *myvariable; } @end @implementation tableViewController -(id)init { myvariable = [[NSMutableArray alloc]initWithObjects:@"Hi2",@"Yo2",@"whatsup2", nil]; } - (void)viewDidLoad { NSLog(@"%@",myvariable); // DISPLAYS NULL [super viewDidLoad]; } Why isn't my variables available in viewdidLoad when I declared and implemented in my .h and .m files? If that's the case, is viewDidLoad or viewWillAppear the common places to load the data for the viewcontroller? It looks like even if you instantiate a viewcontroller, the init function gets called but the viewDidLoad doesn't necessarily have the variables to be displayed. Where's the right place/methods to load the model(data) for my viewcontroller? Thanks in advance

    Read the article

1