ios - Reference view controller from custom UITableViewCell class -


i have class called magradecell that's custom uitableviewcell class. before had class , setting cell inside view controller (macontroller), configureheadercell'd self (which resolved viewcontroller.

now have custom class uitableviewcell, can't refer viewcontroller self. mean should alloc , init new viewcontroller? or have super or import viewcontroller , interface property or something?

try this,

in magradecell.h

typedef void (^yourcallback)(magradecell *cell); //you may or may not use cell parameter according need 

create property

@property (readwrite, copy) yourcallback callback; 

in magradecell.m

- (void)someaction {     if (self.callback != nil) {          self.callback(self);            } } 

in cell configuration method

magradecell *cell = ....  .....  cell.callback = ^(magradecell *gradecell) {         //do stuff     }; 

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 -