Class1 i have
textClass1 = @”Hello”
how to send String to Class2
Label.text = textClass1 ?
Thank you 😀
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.
In your Class1.H set a
protocol:in any class where do you want to get the value, add delegate (in the .H) like this:
Now, implement in Class2.M your
and remember to set delegate for class1!
class1.delegate = self(class2)it’s all!
Now, you are able to call
ASimpleFunctionfrom any classes that implements your protocols!If you don’t like this way, see
NSNotificationsfrom apple docs.hope this helps.