I have a set of attributes that are displayed in Tableview through an Array controller (all bindings), I have written some code to change one of the attributes based on the content of others. I wrote this in the .m file that Core data created for this Entity:
header:
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Instrument;
@interface IO : NSManagedObject
@property (nonatomic, retain) NSNumber * channel;
@property (nonatomic, retain) NSString * depiction;
@property (nonatomic, retain) NSString * prefix;
@property (nonatomic, retain) NSNumber * rack;
@property (nonatomic, retain) NSNumber * slot;
@property (nonatomic, retain) NSString * suffix;
@property (nonatomic, retain) NSString * tag;
@property (nonatomic, retain) NSString * type;
@property (nonatomic, retain) NSString * depictionFull;
@property (nonatomic, retain) Instrument *io_instrument;
@end
main:
#import "IO.h"
#import "Instrument.h"
#import "Loop.h"
#import "Area.h"
@implementation IO {
}
@dynamic channel;
@dynamic depiction;
@dynamic prefix;
@dynamic rack;
@dynamic slot;
@dynamic suffix;
@dynamic tag;
@dynamic type;
@dynamic depictionFull;
@dynamic io_instrument;
- (void)awakeFromFetch{
[self setDepictionFull:[NSString stringWithFormat:@"%@ %@ %@ %@", self.io_instrument.instrument_loop.loop_area.name, self.io_instrument.instrument_loop.depiction, self.io_instrument.depiction, self.depiction]];
}
@end
The are two problems here:
This only changes the table "view" value of my attribute but not the actual saved value (I know this because when I comment-out the code the value does not get saved)
The "awakeFromFetch" function I use only applies the code when I fetch the data but I would also like it to be refreshed when I make a change to any attribute in the entity (or array controller).