i have 2 classes i.e one is "MainClass" and another is "StartView" Class .i want to create array of objects of MainClass into StartView Class.
here i created 10 objects of MainClass and added into one Muttable Array . That Array is also part of MainClass.Its going difficult to access them. Is there any way to create array of objects directly .I want to know how to access and how to create array of objects in another class. Code Is below ...
//MainClass.h
#import <Foundation/Foundation.h>
#import "StartView.h"
#import "TableViewController.h"
@interface MainClass : NSObject
@property(nonatomic, strong) NSString *que;
@property(nonatomic, strong) NSString *img;
@property(nonatomic, strong) NSArray *option;
@property(nonatomic, strong) NSMutableArray *nms;
-(void)ObjectsAssignment;
@end
//MainClass.m
-(void)ObjectsAssignment
{
nms=[[NSMutableArray alloc]init];
MainClass *mc1=[[MainClass alloc]init];
mc1.que=@"Who invented Microprocessor ?";
mc1.img=@"SuperComputer.jpg";
mc1.option=[[NSArray alloc]initWithObjects:@"Joseph
Jacquard",@"Herman H
Goldstein",@"Marcian E Huff",@"George Boole",nil];
[nms addObject:mc1];
MainClass *mc2=[[MainClass alloc]init];
mc2.que=@".INI extention refers to which kind of file ? ";
mc2.img=@"SuperComputer.jpg";
mc2.option=[[NSArray alloc]initWithObjects:@"Joseph Jacquard",
@"Herman H Goldstein",@"Marcian E Huff",@"George Boole",nil];
[nms addObject:mc2];
}
@end