ios - TableCell init with coder and init with style -


i'm trying save custom cell objects , later on show them. fail understand mechanism totally have:

- (id)initwithcoder:(nscoder *)decoder {     if((self = [super init])) {         self.action = [decoder decodeobjectforkey:@"action"];     }     return self; } 

and

- (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier {     self = [super initwithstyle:style reuseidentifier:reuseidentifier];     if (self) {      }     return self; } 

this way variable decoded tablecell doesn't show @ all. if remove init coder tablecell interface showed, can't variable decoded. should make work?

i think can see problem. still, shouldnt save cells themselves. create uitableviewcell-subclass accepts 1 object gather of content. if need more 1 class this, thats fine too. can create several subclasses several usecases. save data-objects , recreate cells when need them again. reason way creates massive overhead, because trying save uiviews, lables, etc make cell. also, uitableviews highly optimized , try reuse existing cells not play approach.

tl;dr: need dataobjects, can save in keyedarchivers, , need tableviewcells accept these objects , display necessary data. seriously, save trouble. let me know if need , have fun


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -