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.
alphaviewcontroller
hasconnectionview
1 ofdelegate
. helps add perform operation on data providedalphaviewcontroller
, show output onalphaviewcontroller's
view.when click on button in
alphaviewcontroller
, showuialertcontroller
. can click button openreportview
.betaviewcontroller
createsreportview
.betaviewcontroller
hasreportgenerator
delegate
.reportgenerator
helps generate html render inbetaviewcontroller'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.
- you can pass output of
connectionview's
alphaviewcontroller
betaviewcontroller
before pushing. when assignbetaviewcontroller
delegate ofreportgenerator
pass data i.econnectionview's
outputreportgenerator
,reportgenerator
process , render data in html inbetaviewcontroller's
view.
it may seem complicated in words can achieved.
there second way simpler above using
appdelegate
. can declare , define property inappdelegate
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
Post a Comment