ios - Passing a delegate to another view controller's delegate -


i'm working build 1 feature in app written in objective-c. can't post code try descriptive world. problem i'm facing related delegates.

  1. alphaviewcontroller has connectionview 1 of delegate. helps add perform operation on data provided alphaviewcontroller , show output on alphaviewcontroller's view.

  2. when click on button in alphaviewcontroller, show uialertcontroller. can click button open reportview. betaviewcontroller creates reportview.

  3. betaviewcontroller has reportgenerator delegate. reportgenerator helps generate html render in betaviewcontroller's view.

my problem that, wanna use connectionview's output (which believe part of connectionview object in alphaviewcontroller), in reportgenerator process , render data in html in betaviewcontroller's view.

i've been messing around find solution haven't been able figure out anything. i'm not delegates.

please assist me achieve goal here. i'm sorry can't post code.

  1. you can pass output of connectionview's alphaviewcontroller betaviewcontroller before pushing. when assign betaviewcontroller delegate of reportgenerator pass data i.e connectionview's output reportgenerator , reportgenerator process , render data in html in betaviewcontroller's view.

it may seem complicated in words can achieved.

  1. there second way simpler above using appdelegate. can declare , define property in appdelegate class , access anywhere in class.

    //interface:  @interface myappdelegate : nsobject  {    nsstring *yourstring; // declare object }  @property (nonatomic, strong) nsstring *yourstring; ... @end  //and in .m file app delegate      @implementation myappdelegate  @synthesize yourstring; yourstring = string;  @end  //you can access property save , retrieve file. can save  myappdelegate *appdelegate = (myappdelegate*)[[uiapplication sharedapplication] delegate]; appdelegate.yourstring = nsstring;     //..to write 

yo can read value in betaviewcontroller or reportgenerator per requirement

myappdelegate *appdelegate = (myappdelegate*)[[uiapplication sharedapplication] delegate]; somestring = appdelegate.mystring;  //..to read 

for no. of properties can create model class , access defined above.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -