numberOfRowsInSection не вызывается для UITableView

У меня возникли некоторые проблемы, когда мой UITableView не перезагружается, я переделал привязку выхода, чтобы убедиться, что это не проблема. Я также пытался использовать [self table] reloadData], но это тоже не работает. Я отладил проблемы, но он просто пропускает reloadData, и приложение продолжает работать, как будто кода там нет.

Верхняя часть моего файла.m, в ViewDidLoad ничего не делается

#import "SettingsCourses.h"

@implementation SettingsCourses
@synthesize settingsCourses;
@synthesize Delegate;
@synthesize BackButton;
@synthesize DeleteButton;
@synthesize table;
@synthesize courses;
@synthesize dataHandler;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    // Custom initialization
    dataHandler = [[DataHandler alloc] init];
    dataHandler.coursesDelegate = self;
    courses = [dataHandler fetchCourses];
    NSLog(@"Debug Count: %i", [courses count]);
}
[table reloadData];
return self;
}

- (void) viewWillAppear:(BOOL)animated {
[table reloadData];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (courses) {
    NSLog(@"Count: %i", [courses count]);
    return [courses count];
}
else {
    NSLog(@"Count: 0");
    return 0;
}
}

Мой файл.h

#import <UIKit/UIKit.h>
#import "dataHandler.h"

@interface SettingsCourses : UIViewController 

@property (strong, nonatomic) DataHandler *dataHandler;
@property (strong, nonatomic) NSMutableArray *courses;
@property (strong, nonatomic) IBOutlet UIView *settingsCourses;
@property (nonatomic, strong) id Delegate;
@property (weak, nonatomic) IBOutlet UIButton *BackButton;
@property (weak, nonatomic) IBOutlet UIButton *DeleteButton;
@property (weak, nonatomic) IBOutlet UITableView *table;


- (IBAction)Delete:(id)sender;
- (IBAction)Back:(id)sender;

Спасибо за любую помощь!

9
задан Markus Tenghamn 14 April 2012 в 17:10
поделиться