2011-10-26 3 views
1

새로운 iOS5 TableView 스타일 코드를 사용하고 있지만 문제가있는 것 같습니다. searching = true 함수가 호출 될 때마다 충돌합니다. 나는 그것을 triyng UITableView 객체를 구성 메소드에 전달하는 것이 BadgedCell을 허용한다고 생각한다. 어떤 아이디어가 이것을 고치는 방법?UITableViewCell에 문제가 발생했습니다.

Crash says: 2011-10-25 22:21:04.973 Social[5719:707] -[__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance 0x392510 

2011-10-25 22:21:04.975 Social[5719:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance 0x392510' 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if(searching) 
    { 
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchCell"]; 
     [self configureCell:cell atIndexPath:indexPath]; 
     return cell; 
    } 
    else 
    { 
     TDBadgedCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BadgedCell"]; 
     [self configureCell:cell atIndexPath:indexPath]; 
     return cell; 
    } 
} 

- (void)configureCell:(TDBadgedCell *)cell atIndexPath:(NSIndexPath *)indexPath 
{ 
    if(searching) 
    { 
     NSDictionary *dictionary = (NSDictionary *)[listOfItems objectAtIndex:indexPath.row]; 
     [cell.textLabel setText:[dictionary objectForKey:@"exerciseName"]]; 
     [cell.detailTextLabel setText:[dictionary objectForKey:@"muscleName"]]; 
     cell.textLabel.text = [listOfItems objectAtIndex:indexPath.row]; 
     cell.detailTextLabel.text = [listOfItems objectAtIndex:indexPath.row]; 
    } 
    else 
    { 
     cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16]; 
     cell.textLabel.text = [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"muscleName"]; 
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
    } 
} 

답변

0

당신 때문에 경우 앞의 세 가지 라인으로, 귀하의 구성 방법 내부에서이 두 줄을 제거해야 의미, 텍스트 필드로 사전을 설정하려고하는 당신의 'LISTOFITEMS'사전의 목록은 다음이다 모든 종류의 문제를 일으킬 textLabel의

cell.textLabel.text = [listOfItems objectAtIndex:indexPath.row]; 
cell.detailTextLabel.text = [listOfItems objectAtIndex:indexPath.row]; 
2

당신은 셀에 문자열로 LISTOFITEMS 사전을 전달하는 :

당신이 사용하는 경우 :

 NSDictionary *dictionary = (NSDictionary *)[listOfItems objectAtIndex:indexPath.row]; 

내가 LISTOFITEMS 많은 사전이 포함되어 있음을 이해합니다. 그래서 당신은 호출 할 때 : 당신은 기본적으로 셀 라벨에 사전을 할당하려고

cell.textLabel.text = [listOfItems objectAtIndex:indexPath.row]; 
    cell.detailTextLabel.text = [listOfItems objectAtIndex:indexPath.row]; 

. Xcode가 [__NSCFDictionary isEqualToString :]을 말하고있는 이유입니다.

해당 행을 제거하려고합니다.

관련 문제