2013-12-18 4 views
0

페이 스북처럼 피드 페이지를 만들려고하고 있습니다. 게으른로드를 사용하여 tableview 셀에 이미지를로드하고 있습니다. 때로는 임의의 셀에서 스크롤 잠금이 발생하지만 위 또는 아래의 다른 보이는 셀을 스크롤하려고하면 스크롤됩니다. 이 문제는 매우 드문 경우입니다. 이 문제의 원인을 바로 잡을 수는 없습니다. 도와주세요.TableView 셀 중지 셀 스크롤

다음은 코드입니다. 뭔가 메인 스레드 (UI를 업데이트 할 책임이 스레드를) 차단과 같은

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    //label to show values of the menu 
    static NSString *CellIdentifier = @"CellIdentifier"; 

    // Dequeue or create a cell of the appropriate type. 
    socialFeedCustomCell *cell = (socialFeedCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
    { 
     cell = [[socialFeedCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ; 
     cell.accessoryType = UITableViewCellAccessoryNone; 
    } 

    for (UIView *tempView in cell.contentView.subviews) { 
     [tempView removeFromSuperview]; 
    } 

     [self renderInstagramData:indexPath cell:cell]; 

    cell.contentView.layer.opaque=YES; 
    cell.layer.shouldRasterize = YES; 
    cell.layer.rasterizationScale = [UIScreen mainScreen].scale; 
    cell.selectionStyle=UITableViewCellSelectionStyleNone; 
    cell.backgroundColor=[UIColor clearColor]; 
    cell.userInteractionEnabled=YES; 

    return cell; 
} 

감사

+0

더 나은 이해를 위해 코드와 스크린 샷을 표시하십시오. –

+0

스크린 샷을 사용하여 스크롤 잠금을 표시 할 수 없습니다. 테이블 뷰에서 스크롤하고 멈추는 상황을 고려할 수 있습니다. – Superdev

+0

코드에 대해서는 사용자 지정 셀을 사용하고 subviews를 tableview의 contentview에 추가하고 있습니다. – Superdev

답변

0

는 것 같습니다. UI 업데이트와 관련없는 모든 작업을 GCD를 사용하여 백그라운드 대기열로 이동합니다. 있는 tableView에서

dispatch_queue_t jsonParsingQueue = dispatch_queue_create("jsonParsingQueue", NULL); 

    // execute a task on that queue asynchronously 
    dispatch_async(jsonParsingQueue, ^{ 
    // Parse your data here 

     dispatch_async(dispatch_get_main_queue(), ^{ 
      // Update your UI in the main thread 
      [self.tableView reloadData]; 
     }); 
    }); 
+0

나는 이미이 기술을 사용하고 있지만, 운이 좋지는 않습니다. 잠긴 셀을 사용하면 탭 제스처, 버튼 클릭 등을 수행 할 수 있지만 스크롤은 수행하지 않습니다. – Superdev

+0

하나 더 이상한이 두 손가락을 사용하여 스크롤하려고 할 때 스크롤됩니다. – Superdev

+0

셀 내부에 다른 스크롤보기가 있습니까? –

0

: 예를 들어 cellForRowAtIndexPath :, cell.contentView.subviews의 전망을 모두 제거하지 마십시오. 아마 당신은 다른 곳에 그보기를 다시 설치하고 있습니다. 이 기술은 표 셀을 다시 사용하는 목적을 거의 무효로합니다.

콘텐츠보기의 하위보기는 그대로 유지합니다. 다른 데이터를 할당하여 다시 사용하십시오. 이렇게하면 성능이 향상됩니다. 그렇지 않으면 renderInstagramData : cell :에 대한 코드를 게시하십시오.