My data is just number, I want pass it from VC1 to VC2 for next calculation, not for showing at label. Maybe that’s not a problem for passing data string using code below. But I don’t know how to pass number integer, like a = b x c. I want to bring that a from VC1 to VC2 for next step calculation like a + d = e. I declare for that a, b, c, d, e is int at .h file
This is how I use to pass string data. But how to do it for integer?
ProcessViewController *ProcessData = [[ProcessViewController alloc]initWithNibName:nil bundle:nil];
self.processViewData = ProcessData;
processViewData.labelViewString = labelView.text; // pass to VC2
[self presentModalViewController:ProcessData animated:YES];
In the .h file of the second view controller you need to add a property:
and obviously synthesize this property in the .m file for the second VC.
then once you’ve initialized the ProcessViewController, you can set the property on it from within the first VC:
Edit: Note that you could also use an NSNumber property if you wanted (not sure why you would in this case). If you did so and you arent using ARC then you would also need to release the property.