ios - how to call View controller of MainStoryBoard from UI cellView xib -
the problem want call view controller of mainstoryboard. have created uicellview in xib file , on have button want move on addlocationvc viewcontroller when pressed button.
i have written code
uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; addlocationvc *view = [storyboard instantiateviewcontrollerwithidentifier:@"addlocation"];
its not worked when pressed button not redirect me on view controller addlocationvc controller coming in section of code.
the efficient way of doing use protocols
or blocks
. delegate protocol
steps be:
- define
delegateprotocol
in custom cellclass
- in
cellforitem/rowatindexpath:
makeviewcontroller
delegate
of cell , implementprotocol
in it. here you'll instantiate newviewcontroller
, present/push it - on button tap call
delegate
method
Comments
Post a Comment