I have two viewcontrollers Viewcontroller1 and viewcontroller2
i have to declare a variable globally and use it in both views, however i have to take the value of the variable in view 1, into view2
How is it possible ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can create a shared class and declare the variable in that
then you can import sharedClass.h in both viewcontroller1 and 2 and use it
Sharedclass *shrdclass;
NB: you can also pass the value of a variable to one view to another view without using a sharedclass so easily,check it here