Wondering what I’m missing here. Relatively new to C and iOS development, so please be nice ;-). In viewController I’ve got a NSMutableArray called _objects with a changing tableView and thus a changing size of the array. To init my NSMutableArray, I’ve done this:
// viewController.m
if (!_objects) {
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:[NSString stringWithFormat:@"%@", x] atIndex:y];
My goal is to use _objects.count in calculatorViewController, so I have done this:
// calculatorViewController.m
NSInteger count = viewController._objects.count;
NSLog(@"Count: %i", count);
However, upon the log, I get Count: 0, even when the count is not zero. What am I missing here?
Thank you!
I guess you are using pushViewController to navigate from viewController to calculatorViewController. If you are doing this then after you create the object of CalculatorViewController, write calculatorViewController.count = [_objects count];