I am pushing a string from one UIViewController to another so far I am doing this successfully however, when I add the pushed string to an NSMutableArray and NSLog the count of the array it always returns me 0 here is my code: I am using storyboards and do I need to reference the second view into the view did load?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[_TableView setDelegate:self];
//[_TableView setDataSource:self];
_numberOfRows = [[NSMutableArray alloc]init];
}
-(void)pushName:(NSString*)contactName
{
//NSLog(@"Pushed name is: %@ ", contactName);
_contactName = contactName;
NSLog(@"Pushed name is: %@ ", _contactName);//<-- Returns the pushed string fine
[_numberOfRows addObject:contactName];
//[self.TableView reloadData];
NSLog(@"Number of names: %d ", [_numberOfRows count]);//<--Always returns a 0
}
Not really sure why this isn't working. If more code is required to clarify this question, then please do ask.