I have a viewController with a property of NSInteger (or NSNumber), What I want to do is pass the integer to the child ViewController, do some change (maybe add by some number).
But when I use NSNumber as property in the parent and child controller and pass it by set property:
//parent and child property.
@property (nonatomic,strong) NSNumber *num;
//pass to the child
child.num = self.num;
//do some change in child
self.num = [NSNumber numberWithInteger:[self.num integerValue] + 1];
This cannot change the value of the parent , because NSNumber is readonly and in the child they alloc a new one, without change the value of the parent.
So:
How I can pass a NSInteger or NSNumber to the child ViewController and change the value in it, and when child is pop away, the parent controller get the change?