So its really weird... I have a ViewController called ListEventsViewController
in the header file:
@interface ListEventsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *eventsTable;
@property (strong, nonatomic) NSArray *events;
@end
In the Implementation I am calling the pretty much mandatory functions below:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [events count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = nil;
cell = [eventsTable dequeueReusableCellWithIdentifier:@"eventCell"];
if(!cell){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"eventCell"];
}
NSString *textLabelTitle = [[events objectAtIndex:indexPath.row] objectForKey:@"name"];
NSString *textLabelDetail = [[events objectAtIndex:indexPath.row] objectForKey:@"date"];
//cell.imageView.image = someimage;
NSLog(@"Text Label Title: %@", textLabelTitle);
NSLog(@"Text Label Detail: %@", textLabelDetail);
cell.textLabel.text = textLabelTitle;
cell.detailTextLabel.text = textLabelDetail;
return cell;
}
The problem is the function - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ is not being called so the cells arent being populated. also the number of cells isnt being allocated either. What could be causing this?
It looks wired up to me heres a picture of the h and IB.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…