Enam Ajmal Enam Ajmal - 4 months ago 8x
Objective-C Question

Array in class.m and how to add values in it Objective-c

I want to add an array in the class and give it some values and call it in the main class. I am using

@property(nonatomic) NSArray *subject;

but I could not access it from implementation class. i want to access it and add some random values in it.

#import "yourClass.h"
@implementation yourClass
@synthesize subject;

- (void)viewDidLoad 
[super viewDidLoad];
subject=[[NSArray alloc]initWithObjects:@"one",@"two",@"three", nil];


in your class.m below @implementation synthesize your array