views:

662

answers:

1

I have an NSArray that I pass in through a delegate method:

- (void)didFinishParsing:(NSArray *)array {
    [self.myArray addObjectsFromArray:array];
    NSLog(@"%@", self.myArray);
    [self.tableView reloadData];
}

There's only one object in the array and I'd like the tableView row count to equal the amount of objects in the array objectAtIndex:0, but I cannot get the count. I have tried:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [[self.myArray objextAtIndex:0] count];
}

How do I get the number of object inside the first (and only) object in my array?

A: 

To count the array at index 0 of self.myArray your syntax is correct. Is your array variable setup how you think it is?

The method call addObjectsFromArray: will add the contents of array to the end of self.myArray.

So in other words: [array objectAtIndex:0] will become [self.myArray lastObject:]

If you're having trouble running count: on [self.myArray objectAtIndex:0] or [self.myArray lastObject] then the object you're trying to count might be nil, empty, not an NSArray/Set as you are expecting it to be.

Jessedc
Hmm. Not really working. I alloc an object with a initWithDictionary method (myParsedObject) instead now, and pass that through in the "- (void)didFinishParsing:(MyParsedObject *)parsedObject" method, but I still cannot get the count for the number of objects contained inside it?
Canada Dev