objective c - Files and their initialization -


a quick question hope. i'm new xcode , ios apps, , have made bunch of tutorials still don't 1 thing. if make new file (staticdata.h, staticdata.m) , in .h declare public property nsmutablearray. , in .m file fill statically.

@implementation staticdata  -(nsmutablearray *)staticarray {      nsstring *value0 = @"test)";       return  [nsmutablearray arraywithobjects:value0, nil];  }   @end 

now import .h file in viewcontroller , try load data in table. array empty. set breakpoint never hit.

so how init file without view?

you need use file creating instance of class staticdata this:

staticdata *data = [[staticdata alloc] init]; 

don't forget delete data when ready!


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -