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
Post a Comment