Я занят созданием приложения, которое загружает кучу имен из .plist. Я настроил его так, чтобы .plist загрузился в UiTableView. Теперь проблема в том, что я получаю код ошибки, когда я пытаюсь открыть меню с таблицей с именами в ней.- [UIViewController tableView: numberOfRowsInSection:]: непризнанный селектор, отправленный в экземпляр 0x7fc748e37ea0 '
Это сообщение об ошибке:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7fc748e37ea0'
Это мой viewController.m
#import "ViewController.h"
#import "Stuff.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
Stuff *s = [[Stuff alloc] init];
[s getStuff];
self.items = [[NSMutableArray alloc] initWithArray:s.stuff];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.items count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath*)indexPath
{
NSString *id = @"plistdata";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:id forIndexPath:indexPath];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:id];
}
cell.textLabel.text = self.items[indexPath.row];
return cell;
}
@end
Спасибо!
@ARE, можете ли вы поделиться тем, что находится в 'ViewController.h'? – Popeye
@ Попай, правда, плохо. Я просто сделал двойную проверку в своем комментарии .. – NorthBlast
@NorthBlast достаточно справедливо Я также удалю свои комментарии – Popeye