- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath wird nicht aufgerufen

Also ist es wirklich komisch ... Ich habe einen ViewController namens ListEventsViewController

in der Header-Datei:

@interface ListEventsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *eventsTable;
@property (strong, nonatomic) NSArray *events;

@end

In der Implementierung rufe ich die folgenden so ziemlich obligatorischen Funktionen auf:

- (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;
}

Das Problem ist die Funktion - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {wird nicht aufgerufen, sodass die Zellen nicht gefüllt werden. Auch die Anzahl der Zellen wird nicht zugewiesen. Was könnte das verursachen?

Es sieht verdrahtet aus, hier ist ein Bild von h und IB.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage