Я знаю, что это часто задаваемый вопрос / проблема. Я просмотрел множество вопросов и ответов для своей проблемы, но, думаю, я немного туп, потому что я нигде не видел ответа.
У меня есть файл в массиве, который я хотел бы использовать для заполнения таблицы.
Проблема в том, что он не вызывается. Также не является numberOfRowsInSection или numberOfSectionsInTableView. Я, насколько я вижу, был вызван только viewDidLoad.
У меня 1 раздел, количество элементов в моем массиве равно 3 (в отличие от нуля).
Соответствующий код здесь ...
- (void)viewDidLoad {
[super viewDidLoad];
FileControl *fileArray = [[FileControl alloc] init];
matArray = [fileArray findUniqueItemsInArray:0 :[fileArray setFileToArray]];
[fileArray release];
NSLog(@"%i \n %@", [matArray count], matArray); // matArray is filled.
NSLog(@"ViewDidLoad"); }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSLog(@"CellForRowAtIndexPath");
NSString *text = [matArray objectAtIndex:[indexPath row]];
[[cell textLabel] setText:text];
return cell; }
@interface MaterialTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *materialTableView;
NSArray *matArray;
}
@property (nonatomic, retain) NSArray *matArray;
@end
Другие методы являются стандартными.
Полагаю, моя проблема в том, что я недостаточно хорошо понимаю поток.
Любая помощь будет принята с благодарностью. Заранее спасибо.