UITableViewCell
클래스를 서브 클래 싱했습니다. 하나는 작동하고 다른 하나는 작동하지 않습니다. 이유를 모르겠습니다. 내 하위 클래스가 UITableViewCell에서 cellForRowAtIndexPath 함수의 UIView 클래스라고 말하고 있습니까?
이
오류가 발생 기능입니다 : 내가 알아낼 수없는 이유- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
NSString *type = [object objectForKey:@"type"];
static NSString *CellIdentifier1 = @"Cell1";
static NSString *CellIdentifier2 = @"Cell2";
if ([type isEqualToString:@"quote"]) {
QuoteCell *cell = (QuoteCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell == nil) {
cell = [[QuoteCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
}
cell.contentText.text = [object objectForKey:self.textKey];
NSDate *date = object.createdAt;
cell.datetimeLabel.text = [NSDate stringForDisplayFromDate:date];
return cell;
}
else if([type isEqualToString:@"photo"])
{
TestCell *cell = (TestCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
if (cell == nil) {
cell = [[TestCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier2];
}
return cell;
}
return nil;
}
을의 UITableViewCell
의 TestCell
클래스의 서브 클래스 중 하나가 대신 UIView
것을 말한다 UITableViewCell
? 나는 두 클래스를 정확히 서브 우퍼 UITableViewCell
과 동일하다고 생각하지만 QuoteCell
은 UITableViewCell
과 TestCell
은 그 것이고 UIView
이라고 말합니다. 여기
인해 캐치되지 않는 'NSInvalidArgumentException'예외 응용 프로그램 종료, 이유는 : '- [UIView의 setTableViewStyle는 :] : 인식 할 수없는 선택기 예를 0x96b7b70로 전송'
어떤 아이디어가?
두 시간 동안이 문제에 얽매이지 않고 게시 한 후 10 분 만에 알아 냈습니다. 그것은 내가 UITableViewCells를 어떻게 만들고 있는지와 관련이있었습니다. 나는 UITableViewCell을 확장하는 클래스를 만들고 TestCell.m initWithStyle 함수에서 MainBundle에서 nibArray를 얻지 만 셀의 인덱스가 실제로 변경되어 셀의 UIImageView가 실제로 변경되어 펜촉을 찾기위한 인덱스를 변경해야했다. 셀 자체의 배열에서. 이미 응답 해 주신 모든 분들께 감사드립니다.
모든 예외에 대한 중단 점을 설정하십시오. 실행이 throw 된 순간에는 던져진 코드 줄과 동일한 오류 메시지가 표시됩니다. 모든 정보를보기 전에 계속 2 또는 3 번 눌러야 할 수도 있습니다. 그런 다음이 코드 줄을 사용하여 우리에게 돌아가서 UITableViewCell이 예상 될 때 UIView에 액세스하는 이유가 무엇인지 알아 내려고 노력합니다. –
테스트 셀은 UIVIew의 하위 클래스입니다. 그래서 Uiview 당신 tableviewstyle 설정할 수 없습니다 –
몇 시간 동안이 문제에 붙어있는 후, 나는 게시 한 후 10 분 그것을 알아 냈다. 그것은 내가 UITableViewCells를 어떻게 만들고 있는지와 관련이있었습니다. 나는 UITableViewCell을 확장하는 클래스를 만들고 TestCell.m initWithStyle 함수에서 MainBundle에서 nibArray를 얻지 만 셀의 인덱스가 실제로 변경되어 셀의 UIImageView가 실제로 변경되어 펜촉을 찾기위한 인덱스를 변경해야했다. 셀 자체의 배열에서. 감사합니다 Hermann과 Uma. – durbin