테이블 뷰를 배우려고하고 있는데 걸렸습니다. Storyboard에 뷰 대리자와 데이터 소스가 올바르게 연결되어 있지만 테이블 뷰가 포함 된 응용 프로그램 섹션에 도달하면 다음 런타임 오류가 발생합니다. 당신의 CraftingViewController
클래스는 아마 유형 UITableViewController
의처럼 보인다 동안Xcode TableView - 인스턴스로 전송 된 인식 할 수없는 셀렉터
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationItem tableView:numberOfRowsInSection:]: unrecognized selector sent to instance
여기 내 구현 파일
@implementation CraftingViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Detail";
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
감사합니다, 그것은 내가의 ViewController가 아닌 네비게이션 컨트롤러에 연결된 테이블보기를했다 판명이 컨트롤러 사용 "CraftingViewController"없다 "의 UIViewController"의 ALLOC를 확인하세요 – Alex