ios - Pass data from one viewcontroller to existing viewcontroller programmatically -
recently stuck in problem cannot move on next coding part. there 2 view controllers(let's first.m , second.m) , pass parameter data 1 view controller without using storyboard. tricky part me second view controller initiated in appdelegate.m file.
i can pass data if have initiated second view controller in first view controller importing header file, example..
@import "second.h" second *secondview = [[second alloc] initwithnibname:@"secondnib" bundle:nil]; secondview.somestringvalue = @"passthisstring";
however, coding makes new second view controller, not want. found there like
myappdelegate *appdelegate = (myappdelegate *)[[uiapplication sharedapplication] delegate];
to connect appdelegate.m file. after few days struggling brain getting blackout. please give me advice.. there way pass data existing view controller without using storyboard? or way through appdelegate second view controller. appreciated
@jazzed28 can without initiating second
. need access initiated second
. declare second
in myappdelegate.h
property
of -
@property (nonatomic, strong) second *svc;
then whenever need second can access -
myappdelegate *appdelegate = (myappdelegate *)[[uiapplication sharedapplication] delegate]; appdelegate.svc
Comments
Post a Comment