2013-08-22 2 views
0

이미지 뷰 및 텍스트의 동적 이미지를로드하려고했는데, 시뮬레이터와 ios 디바이스 모두에서 작동합니다. 어떻게 나에게 조언을UITextview가있는 사용자 정의 UITableView가 ios 디바이스에서 부드럽게 스크롤되지 않습니다.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
     { 
      ImageCell *cell = (ImageCell *)[self.TestTable dequeueReusableCellWithIdentifier:@"ImageCell"]; 
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
    { 
     if (cell == nil) { 
      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ImageCell" owner:self options:nil]; 
      cell = [topLevelObjects objectAtIndex:0]; 
     } 
    } 
    else 
    { 
     if (cell == nil) 
     { 

      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ImageCell" owner:self options:nil]; 
      cell = [topLevelObjects objectAtIndex:0]; 
     } 
    } 

[email protected]"Cable and Hose Carriers"; 

cell.ProductsImages.image = [UIImage imageNamed:@"cool.jpg"]; 



return cell; 
} 

을 (코드 아래 참조)하지만 사용자 정의의 tableview 세포에서 uitextview에 데이터를로드하려고하는 경우의 tableview 원활 (끊김) 스크롤되지 IOS 장치에 있지만 simulator.Please에서 잘 작동 더 낫다.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
     { 
      ImageCell *cell = (ImageCell *)[self.TestTable dequeueReusableCellWithIdentifier:@"ImageCell"]; 
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
    { 
     if (cell == nil) { 
      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ImageCell" owner:self options:nil]; 
      cell = [topLevelObjects objectAtIndex:0]; 
     } 
    } 
    else 
    { 
     if (cell == nil) 
     { 

      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ImageCell" owner:self options:nil]; 
      cell = [topLevelObjects objectAtIndex:0]; 
     } 
    } 
cell.ProductsDetailsTextView.delegate = self; 
cell.ProductsDetailsTextView.text=[Descriptions objectAtIndex:indexpath.row]; 

return cell; 
} 

답변

3

주 스레드에서 모든 작업을 수행하려고합니다. 주 스레드가 왜 tableview가 원활하게 스크롤되지 않는지 데이터의 동적 로딩 때문에 블로킹을 시작합니다. 다른 대기열에 코드를 작성해보십시오.

// call background queue for dynamic loading of data 
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ 


    // load your dynamic data here 

    // call main queue here 
    dispatch_async(dispatch_get_main_queue(), ^{ 
    // after loading data in background. use your downloaded data here. 
    }); 
}); 

그게 전부입니다.

+0

다시 시도했지만 느슨한 부드러운, UITextview에 대해서만 일어나는 – Dsk

관련 문제