I have a view that implements UITableView. I have a method called setData that allows me to pass in a NSMutableArray. Once I do this I call [self reloadData]. My understanding is that once this is called all the functions that check for the array and set the table cells are supposed to run.
I've put some log statements and also tried setting break points and none of that code is getting called at all. Wondering what I am doing wrong.
Here is my .m code.
#import "JornadaKMLList.h"
@implementation JornadaKMLList
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
-(void)setData:(NSMutableArray*)value
{
collection = value;
[self reloadData];
}
//table view stuff
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSLog(@"this is line 33");
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"this is line 39");
return [collection count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"this is line 43");
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
}
// Configure the cell...
KmlVO *vo = [collection objectAtIndex:indexPath.row];
cell.textLabel.text = vo->title;
return cell;
}
@end
And here is my .h code
#import <UIKit/UIKit.h>
#import "JornadaKMLList.h"
#import "KmlVO.h"
@interface JornadaKMLList : UITableView <UITableViewDelegate,UITableViewDataSource>
{
NSMutableArray *collection;
}
-(void)setData:(NSMutableArray*)value;
@end