title: UITableView Not Smooth Scrolling during dynamic cell contents change based on the settings
body: <p>I have a Table View that rows data display basis on the user settings. 
  Like I have check box for Task, Start Date, Priority , Process, State , Description Etc.</p>
  
  <p>I user check Task and Description then I create <code>UITableViewCell</code> then Add Label for Task And Description if user check All the Settings then Cell should Display all the Label created.</p>
  
  <p>What Problem I am facing is that <code>UITableView</code> Not Scrolling smoothly its not reusing the cell when user scrolls it second Time after Loading the settings.</p>
  
  <p>Below is the code</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *cellMainNibID = @"cellMain";
      NSUInteger count=[arrSettings count];
      TaskItem* item=[self.arrTaskList objectAtIndex:indexPath.row];
      CGFloat y=2;
      UITableViewCell* cell=(UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:cellMainNibID];
      if (_cellMain == nil)
      {
  
          cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellMainNibID];
  
  
          for (int i=0; i&lt;count; i++)
          {
              UILabel *lbll=(UILabel*)[cell.contentView viewWithTag:indexPath.row+ i+200];
              NSLog(@" cell label = %@",lbll); //**Return null always**
              UILabel* lbl=[[UILabel alloc]initWithFrame:CGRectMake(10, y, 310, 14)];
              lbl.tag=indexPath.row+ i+200;
              lbl.backgroundColor=[UIColor clearColor];
              lbl.textColor=[UIColor whiteColor];
              lbl.font=[UIFont boldSystemFontOfSize:14];
  
              [cell.contentView addSubview:lbl];
              lbl=nil;
  
  
              NSString* str=[arrSettings objectAtIndex:i];
              CGRect rect;
              if ([str isEqualToString:@"description"])
                  rect=CGRectMake(8, y+14, 290, 50);
  
              else
                  rect=CGRectMake(110, y, 290, 14);
  
              UILabel *lblll=(UILabel*)[cell.contentView viewWithTag:indexPath.row+ i+400];
              NSLog(@" cell label = %@",lblll); //**Return null always**
  
              UILabel* lbl2=[[UILabel alloc]initWithFrame:rect];
              lbl2.backgroundColor=[UIColor clearColor];
              lbl2.tag=indexPath.row+i+400;
              lbl2.textColor=[UIColor whiteColor];
              lbl2.font=[UIFont systemFontOfSize:14];
  
              lbl2.numberOfLines=5;
              lbl2.lineBreakMode=NSLineBreakByCharWrapping;
              [cell.contentView addSubview:lbl2];
              y+=lbl2.frame.size.height+1;
              lbl2=nil;
  
          }
      }
  
      for (int i=0; i&lt;count; i++)
      {
          UILabel* lbl=(UILabel*)[cell.contentView viewWithTag:indexPath.row+i+200];
          lbl.text=[[[arrSettings objectAtIndex:i]uppercaseString]stringByAppendingString:@":"];
  
          UILabel* lbl2=(UILabel*)[cell.contentView viewWithTag:indexPath.row+i+400];
          lbl2.text=[item valueForKey:[arrSettings objectAtIndex:i]];
      }
  
  
  
  
  
  
      cell.contentView.backgroundColor=[UIColor clearColor];
      cell.backgroundColor=[UIColor clearColor];
      _cellMain.contentView.backgroundColor=[UIColor clearColor];
      _cellMain.backgroundColor=[UIColor clearColor];
  
      UIButton *btnCheck=[UIButton buttonWithType:UIButtonTypeCustom];
      btnCheck.tag=indexPath.row+300;
      if ([arrSelectedRow containsObject:[NSNumber numberWithLong:btnCheck.tag-300]])
      {
          [btnCheck setImage:[UIImage imageNamed:@"cb_glossy_on@2x.png"] forState:UIControlStateNormal];
      }
      else
      {
          [btnCheck setImage:[UIImage imageNamed:@"cb_glossy_off@2x.png"] forState:UIControlStateNormal];
      }
  
      btnCheck.frame=CGRectMake(295, cell.center.y-22, 33, 33);
      [btnCheck addTarget:self action:@selector(checkClicked:) forControlEvents:UIControlEventTouchUpInside];
      cell.accessoryView=btnCheck;
      btnCheck=nil;
  
      return cell;
  }
  
  
  - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      NSUInteger count=[arrSettings count];
      CGFloat totalHeight=(16*count)+(count*2);
      if (isDesc)
          totalHeight+=60;
      return totalHeight;
  
  }
  </code></pre>
  
  <p>Could anyone please suggest me how to display the dynamic data in <code>UITableView</code> based on User Settings for <code>UITableViewCell</code> Labels ?</p>