I am doing following things in my sample application:
I made a model class and declared an array as property in it.
@interface MyModel : NSObject
@property (strong, readwrite) NSArray *charactersToDisplay;
@end
In my app delegate class, I declared MyModel as a property.
@interface MyAppDelegate : NSObject <NSApplicationDelegate>
@property (strong, readwrite) MyModel *myModel;
@property (weak) IBOutlet NSObjectController *myModelController;
- (IBAction)test:(id)sender;
@end
In MainMenu.xib, I dragged and dropped an object controller object and performed its binding to myModel in MyAppDelegate.
I am trying to achieve following thing:
I have defined an action test:, which is bind to a button, in MyAppDelegateChange and trying to change value in charactersToDisplay.
Problem is:
When I am using this code, it is not working:
[self.myModel setCharactersToDisplay:[[NSArray alloc] initWithObjects:@"1",@"2", @"3", "@4", @"5", nil]];
but, if I am trying to change its value through object controller using below code, it is working:
[[self.myModelController content] setCharactersToDisplay:[[NSArray alloc] initWithObjects:@"1",@"2", @"3", "@4", @"5", nil]];
Can anyone suggest me - why it is not working when I am trying to change the value directly by calling setter method on myModel ?