Been playing around with XCode for about 2 weeks now, and reading about MVC a bit. I have a problem trying to connect the Model to the Controller because I find it hard to g
Here is an example that creates an NSMutableArray instance variable in the Controller class and adds a Person object to that array each time you evoke doSomeWork:
@interface Controller
NSMutableArray *personArray;
@end
@implementation Controller
- (void) viewDidLoad {
................
NSMutableArray *personsArray = [[NSMutableArray alloc] initWithCapacity:40];
}
- (IBAction)doSomeWork {
Person *myPerson = [[Person alloc] init];
myPerson.name = name;
myPerson.age = age;
[personsArray addObject:myPerson];
}
@end