Enam Ajmal Enam Ajmal -5 years ago 128
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.

Answer Source
#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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download