iphone - iOS How to tell the App Delegate to present a new view from the current view -


i have iphone application receives notifications when user not using application. when user clicks on notification, should brought new view when user opens application result of opening notification.

the delegate method within app delegate use pass information notification is:

-(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo{  //pass data json payload in here  //tell current view go new view  } 

i believe reference last view controller user interacting before exiting application method go , storing object in nsuserdefaults.

any suggestions on how implement appreciated.

try nsnotificationcenter :) register observer push should done , fire notification appdelegate. take tutorial registration , firering ;)

// appdelegate -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo{      //pass data json payload in here     nsobject *obj = myinformationforthereciever;     [[nsnotificationcenter defaultcenter] postnotificationname:@"gotoview" object:obj]; } 

-

// myviewcontroller -(void)viewdidload {     [super viewdidload];     // stuff      [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(gotoview:) name:@"gotoview" object:nil]; }  - (void)gotoview:(nsnotification*)notification {     nsobject* myinformationforthereciever = [notification object];     // stuff } 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -