title: UITableview slow scrolling, or mismatched cell position
body: <p>My <code>UITableView</code>, when scrolling is lagging. This is my code:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      CellListsFriend *cell = [tableView dequeueReusableCellWithIdentifier:@"cellListsFriend" forIndexPath:indexPath];
      if (!cell.selected) {
          cell.accessoryType = UITableViewCellAccessoryNone;
      }
      ContactAlphaB *contact = [self objectAtIndexPath:indexPath];
      NSMutableAttributedString *strFullname;
      if (strFullname == nil) {
          strFullname = [NSString DrawColorForFullname_firstName:contact.firstName lastName:contact.lastName];
      }
      cell.lblNameFriend.attributedText = strFullname;
      cell.lblStatusSentense.text = contact.usernameIsUsing;
      [cell.lblStatusSentense setTextColor:[SomeMethods_TrinhVM TrinhVM_colorWithHexString:color_status_ShowUser]];
      if ([contact.registerType isEqualToString:@"1"]) {
          cell.lblRegisterType.text = @"Email";
      }
      else{
          cell.lblRegisterType.text = @"Mobile";
      }
      [NSURLConnection getImage:contact.linkAvatar showImage:cell.imgAvatarFriends];
      [cell.lblRegisterType setTextColor:[SomeMethods_TrinhVM TrinhVM_colorWithHexString:@"777777"]];
      // Rounded Rect for cell image
      cell.imgAvatarFriends.layer.borderWidth=2;
      cell.imgAvatarFriends.layer.borderColor=[[UIColor whiteColor]CGColor];
      [cell.imgAvatarFriends.layer setCornerRadius:cell.imgAvatarFriends.frame.size.width/2];
      [cell.imgAvatarFriends.layer setMasksToBounds:YES];
      return cell;
  }
  </code></pre>
  
  <p>My methods get image from document direction:</p>
  
  <pre><code>+(UIImageView *)getImage:(NSString*)strImageName showImage:(UIImageView*)showImage{
      NSString* fileName = [NSString stringWithFormat:@"%@",strImageName];
      NSArray *arrayPaths =
      NSSearchPathForDirectoriesInDomains(
                                          NSDocumentDirectory,
                                          NSUserDomainMask,
                                          YES);
      NSString *path = [arrayPaths objectAtIndex:0];
      NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];
      NSData *data = [NSData dataWithContentsOfFile:pdfFileName];
      UIImage *image1 = [UIImage imageWithData:data];
      showImage.image = image1;
      return showImage;
  }
  </code></pre>
  
  <p>I have researcheed and use: </p>
  
  <pre><code>dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
      dispatch_async(queue, ^{
  </code></pre>
  
  <p>My code is already edited like below:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      CellListsFriend *cell = [tableView dequeueReusableCellWithIdentifier:@"cellListsFriend" forIndexPath:indexPath];
      ContactAlphaB *contact = [self objectAtIndexPath:indexPath];
      [cell.lblRegisterType setTextColor:[SomeMethods_TrinhVM TrinhVM_colorWithHexString:@"777777"]];
      NSString *strNameImg = contact.linkAvatar;
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
      dispatch_async(queue, ^{
  //        [NSURLConnection getImage:strNameImg showImage:cell.imgAvatarFriends];
          cell.lblNameFriend.attributedText = [NSString DrawColorForFullname_firstName:contact.firstName lastName:contact.lastName];
          cell.lblStatusSentense.text = contact.usernameIsUsing;
          [cell.lblStatusSentense setTextColor:[SomeMethods_TrinhVM TrinhVM_colorWithHexString:color_status_ShowUser]];
          if ([contact.registerType isEqualToString:@"1"]) {
              cell.lblRegisterType.text = @"Email";
          }
          else{
              cell.lblRegisterType.text = @"Mobile";
          }
          NSArray *arrayPaths =
          NSSearchPathForDirectoriesInDomains(
                                              NSDocumentDirectory,
                                              NSUserDomainMask,
                                              YES);
          NSString *path = [arrayPaths objectAtIndex:0];
          NSString* pdfFileName = [path stringByAppendingPathComponent:strNameImg];
          NSData *data = [NSData dataWithContentsOfFile:pdfFileName];
          UIImage *image1 = [UIImage imageWithData:data];
          cell.imgAvatarFriends.image = image1;
      });
      // Rounded Rect for cell image
      cell.imgAvatarFriends.layer.borderWidth=2;
      cell.imgAvatarFriends.layer.borderColor=[[UIColor whiteColor]CGColor];
      [cell.imgAvatarFriends.layer setCornerRadius:cell.imgAvatarFriends.frame.size.width/2];
      [cell.imgAvatarFriends.layer setMasksToBounds:YES];
      return cell;
  }
  </code></pre>
  
  <p>It does not lag, but it moves the position of the cell. How to I can resolve this problem?</p>