- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath nie jest wywoływany

Więc to naprawdę dziwne ... Mam ViewController o nazwie ListEventsViewController

w pliku nagłówkowym:

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

@end

W Implementacji nazywam poniższe obowiązkowe funkcje:

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

Problemem jest funkcja - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {nie jest wywoływana, aby komórki nie były wypełniane. również liczba komórek nie jest przydzielana. Co może to powodować?

Wygląda na to, że mam do czynienia z obrazem h i IB.

questionAnswers(4)

yourAnswerToTheQuestion