2013-02-24 3 views
0

내 앱에서 하나의 UITableView에 문제가 있습니다. 다른 모든 테이블처럼 설정했지만 여전히 한 셀에는 [UIColor clearColor] 대신 항상 흰색 배경이 있습니다. 이 내가 tableView:cellForRowAtIndexPath:을 구현하는 방법입니다UITableView의 이상한 동작 - 한 셀이 다르게 표시됨

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *cellIdent = @"NewSessionCell"; 

    UITableViewCell *cell = [self.tableSubjects dequeueReusableCellWithIdentifier:cellIdent]; 

    if (cell == nil) { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdent]; 
    } 

    [cell setAutoresizesSubviews:NO]; 
    [cell setBackgroundColor:[UIColor clearColor]]; 

    // set text color and font 
    [cell.textLabel setTextColor:[UIColor whiteColor]]; 
    [cell.textLabel setFont:[UIFont systemFontOfSize:18.0]]; 

    // set clear background for selected cell 
    UIView *backView = [[UIView alloc] initWithFrame:CGRectZero]; 
    backView.backgroundColor = [UIColor clearColor]; 
    [cell setSelectedBackgroundView:backView]; 

    // set highlight text color to dark gray 
    float colValue = 0.2; 
    [cell.textLabel setHighlightedTextColor:[UIColor colorWithRed:colValue green:colValue blue:colValue alpha:1]]; 

    // set title 
    [cell.textLabel setText:[(self.subjects)[indexPath.row] caption]]; 

    return cell; 
} 

이 정확히 응용 프로그램의 다른 모든 테이블과 동일하지만, 아래 스크린 샷에서 볼 수 있듯이이 특정 테이블에서, 하나의 셀은 항상 흰색입니다.

이것은 iPhone 4S 및 시뮬레이터에서 발생합니다. 전화/시뮬레이터에서 응용 프로그램을 삭제하려고 시도했습니다. XCode를 다시 시작하고 &을 다시 작성하십시오. 아무 것도 변경되지 않았습니다.

screenshot of table with white cell

+0

Xcode 디버거가 그 한 인스턴스에서 당신에게 무엇을 말합니까? – zaph

+0

모든 것이 정상적으로 보입니다. 오른쪽 클릭과 "Print description ..."은 로그에 다음과 같이 씁니다 :'> >> 변수보기에서 변수를 확장하면 다음과 같이 표시됩니다. [screenshot] (http://imgur.com/ge4a33V) – cLar

답변

0

나는 방법 또는 이유는 모르겠지만, 문제는 어떻게 든 setBackgroundColor: 방법과 관련이 있습니다. 제거해도 문제가 지속되면 [UIColor clearColor]을 제외한 모든 색상으로 설정하면 이 아닌은 배경색을 변경하지만 셀이 올바르게 표시됩니다.

관련 문제