ios5 - how to access a variable from another nib file in ios -



ios5 - how to access a variable from another nib file in ios -

i have 2 view controller files inputviewcontroller , currencyviewcontroller. want access variable declared in inputview within currencyview. designed in empty application project.

you can declare variable globally in appdelegate & can access in both viewcontroller. changes made in variable reflect in both controllers. create variable property of appdelegate.h class eg. @property (strong, nonatomic) nsstring *var; & synthesize in appdelegate.m @synthesize var; declare "appdelegate * appdelegate" in both controllers.h & in controller.m in viewdidload write appdelegate=[[uiapplication sharedapplication]delegate]; variable can accessible using appdelegate.var anywhere in code of both viewcontroller & changes reflected in both. hope work more efficiently need.

ios ios5

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -