ios - UITableViewCell dequeueReusableCellWithIdentifier with custom initializer -


i'm using [uitableview registerclass: forreuseidentifier:] , [uitableview dequeuereusablecellwithidentifier:] in order queue , dequeue uitableviewcells.

for example, in viewdidload:

[self.storetableview registerclass:[storelinegraphcell class] forcellreuseidentifier:@"storelinegraphcellidentifier"];

and in cellforrowatindexpath:

storelinegraphcell *cell = (storelinegraphcell*)[self.storetableview dequeuereusablecellwithidentifier:@"storelinegraphcellidentifier"];

in doing this, initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier initializer called uitableviewcell. problem need use custom initializer in order create cell necessary options. example, ability this:

storelinegraphcell *cell = [[storelinegraphcell alloc] initwithreuseidentifier:@"storelinegraphcell" islocked:yes isupcoming:yes];

this doesn't seem possible registerclass & dequeue pattern. i'd keep in initializer should run once, not every time cell dequeued. there proper way accomplish this?

while follow usual pattern cell re-usage (as register class & dequeue), not see easy implement way of doing that.

if create additional initialization method (not following usual init pattern of obj-c) or setters , call following dequeuereusablecellwithidentifier call.

storelinegraphcell *cell = (storelinegraphcell*)[self.storetableview dequeuereusablecellwithidentifier:@"storelinegraphcellidentifier"]; [cell furtherinitwithlocked:yes andupcoming:no]; // ... or 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -