The
I attribute a set are displayed in tableview through an array controller (the binding), I For some of the code written, change one of the attributes based on the content of others I wrote it in .m file, which is the main data created for this unit: Header: Main: There are two problems: It only changes the table "View" value of my property, but not the actual saved value (I know because when I note that the value is not saved) I when I receive data using "awakeFromFetch" function only if it does But when I make any changes to any feature in the unit (or arr controller), then refresh me again Rina likes. The best way of doing this is to save a value In this way it will always bring the latest price, anyway! It's working in a lazy way, which iOS and Objective-work well. It is usually not a bad idea to do this, whenever the qualities or properties are completely dependent on other qualities or qualities. As long as there is no savings: I guess the price is being displayed properly and not saved because you do not save it clearly. Finally, you should not put this code in your actual NSManagedObject subclass. What if you add an attribute and need to recreate this class? Then (if you are using the XCodes creation tool) it will completely erase your custom update -. How to use categories To go to a class to create file - & gt; New - & gt; Select Objective-category under File (or Command + N), then Cocoa Touch . Name your class AddOn (or something like) to put subclass your NSManagedObject and under category (in this case
#import & lt; Foundation / Foundation H & gt; #import & lt; CoreData / Cordaita H & gt; @ Class instrument; @InsertationIo: Nsmainage Object @ Property (Nonomatic, Written) NSNM * Channel; @protecti (nontamic, retten) nssting * illustration; @protecti (nonatomatic, retaining) NSString * prefix; @prompoti (nanatomic, raten) nsnm * rack; @product (nontomic, retten) NSNumber * slot; @property (nonatomic, retain) NSString * suffix; @product (nontomic, retten) nsstaining * tags; @property (nonatomic, retain) NSString * type; @property (nontomic, retten) nssting * diphtip; @property (non-rhetique), instrument * io_instrument; @end
#import "IO.h" #import "Instrument.h" #import "loop .h "#import" Area.h "@ Implementation IO {@} dynamic channel; @ Dynamic illustration; @dynamic prefix; @ Dynamic rack; @ Dynamic slot; @ Dynamic suffix; @ Dynamic tag; @ Dynamic type; @ Dynamic illustration; @ 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
depictionFull Rather go back to the request and return it.
- (NSString *) dipictionFull {return [NSString stringWithFormat: @ "% @% @% @% @", self.io_instrument.instrument_loop.loop_area.name, self.io_instrument.instrument_loop. Illustration, self. Io_instrument.depiction, self-replicating]; }
awakeFromFetch . Instead, create
category for
IO and enter your custom code there. So if you do not change your
again, NSManagedObject implementation changes in its category
source ). The method created after this is
- (NSString *) dipictionFull; Place
.h in and the subsequent implementation in
.m . Then when you want to import this method to
Tools> addOn.h , then that code requires
dipificationFull . So just call it
[self.myInstrument dipictionFull] and you get your string which is always up to date, because it is pulling values every time you live.
No comments:
Post a Comment