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.
alphaviewcontrollerhasconnectionview1 ofdelegate. helps add perform operation on data providedalphaviewcontroller, show output onalphaviewcontroller'sview.when click on button in
alphaviewcontroller, showuialertcontroller. can click button openreportview.betaviewcontrollercreatesreportview.betaviewcontrollerhasreportgeneratordelegate.reportgeneratorhelps generate html render inbetaviewcontroller'sview.
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.
- you can pass output of
connectionview'salphaviewcontrollerbetaviewcontrollerbefore pushing. when assignbetaviewcontrollerdelegate ofreportgeneratorpass data i.econnectionview'soutputreportgenerator,reportgeneratorprocess , render data in html inbetaviewcontroller'sview.
it may seem complicated in words can achieved.
there second way simpler above using
appdelegate. can declare , define property inappdelegateclass , 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
Post a Comment