I have two view controller in storyboard.
VC1 has three buttons and VC2 has a image view.
When click button A in VC1, then VC2 show image of A.
When click button B in VC1, then VC2 show image of B.
How VC2 can know which button was clicked in VC1?
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.
This is simple!!!
1) in VC2 create NSString property in .h file and then synthesize that in .m file “NSStringObjofVC2”
2) import VC2 in VC1 .h file #import “VC2”
and create object like this
VC2 *vc2Obj;
3) in viewdidload method
vc2Obj = [[VC2 alloc] init];
4) on each button click add this
vc2Obj.NSStringObjofVC2 = @”differentImageNameforAll3Buttons.png”;
last to use the image in VC2
simply use NSStringObjofVC2 in UIImage as filename