How do I set the array in my model-class ValueItem
with the content of an NSArrayController
in my AppDelegate class:
@interface AppDelegate : NSObject <NSApplicationDelegate>
{
ValueItem *vi;
}
and:
@implementation AppDelegate
{
ValueItem *array = [[ValueItem alloc]init];
[array setValueArray:[outArrayController arrangedObjects]];
NSArray *testArray2 = vi.valueArray; // !!!getter or setter doesn't work!!!
NSLog(@"test array 2 is:%@", testArray2);
}
NSLog
returns NULL
. What do I miss here?
(valueArray is initialized with @property
and @synthesize
)
ValueItem.h:
#import <Foundation/Foundation.h>
@interface ValueItem : NSObject
{
NSNumber *nomValue;
NSNumber *tolerancePlus;
NSNumber *toleranceMinus;
NSMutableArray *valueArray;
}
@property (readwrite, copy) NSNumber *nomValue;
@property (readwrite, copy) NSNumber *tolerancePlus;
@property (readwrite, copy) NSNumber *toleranceMinus;
@property (nonatomic, retain) NSMutableArray *valueArray;
@end
ValueItem.m:
#import "ValueItem.h"
@implementation ValueItem
@synthesize nomValue, tolerancePlus, toleranceMinus;
@synthesize valueArray;
-(NSString*)description
{
return [NSString stringWithFormat:@"nomValue is: %@ | tolerancePlus is: %@ | toleranceMinus is: %@", nomValue, tolerancePlus, toleranceMinus];
}
@end