Found The solution with help of @parcs and @payal- This link helped -> http://www.appcoda.com/customize-table-view-cells-for-uitableview/
Basically , the table view lags when i scroll, i have gone through many post but it didn't help-
UITableView in UIScrollview scrolling delay
Delayed UIImageView Rendering in UITableView
UITableView lags while scrolling
This is the code , which i am using in cellForRowIndexpath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"WorkoutCell";
WorkoutCell *cell = (WorkoutCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell)
{
UIViewController *controller=[[UIViewController alloc] initWithNibName:CellIdentifier bundle:nil];
cell=(WorkoutCell *)controller.view;
}
[[cell contentView] setBackgroundColor:[UIColor clearColor]];
[[cell backgroundView] setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundColor:[UIColor clearColor]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//diplaying Workout Data
[cell setupFont];
cell.lblPoint.text=[NSString stringWithFormat:@"%@",[[arrTblData objectAtIndex:indexPath.row]valueForKey:@"point"]];
cell.lblReps.text=[[arrTblData objectAtIndex:indexPath.row]valueForKey:@"reps"];
cell.lblWorkoutCategory.text=[[arrTblData objectAtIndex:indexPath.row]valueForKey:@"workout"];
cell.lblWeight.text=[[arrTblData objectAtIndex:indexPath.row]valueForKey:@"weight"];
cell.lblSets.text=[[arrTblData objectAtIndex:indexPath.row]valueForKey:@"sets"];
//Formatting Date
cell.lblPostedDate.text=[NSString stringWithFormat:@"Posted On: %@",[self formatDate:[[arrTblData objectAtIndex:indexPath.row]valueForKey:@"time"]]];
return cell;
}
The Function SetupFont called from cellForRowIndexpath -
(void)setupFont
{
self.lblPoint.font=DEFAULT_FONT(13);
self.pointLblScreen.font=DEFAULT_FONT(13);
self.lblPostedDate.font=DEFAULT_FONT(13);
self.lblReps.font=DEFAULT_FONT(13);
self.lblSets.font=DEFAULT_FONT(13);
self.lblWeight.font=DEFAULT_FONT(13);
self.lblWorkoutCategory.font=DEFAULT_FONT(18);
self.lblWorkoutCategory.strokeColor=kStrokeColor2;
self.lblWorkoutCategory.strokeSize = kStrokeBigSize;
for(UILabel *lbl in [self subviews])
{
if(lbl.tag==9)
{
lbl.font=DEFAULT_FONT(13);
}
}
}
Format Date Function called from cellForRowIndexpath
#pragma mark - Format Date Function
-(NSMutableString*)formatDate:(NSString*)date
{
NSMutableString *formattedDate=[[NSMutableString alloc]init];
NSUInteger p = 0;
NSUInteger length = [date length];
while ( p < length) {
unichar ch = [date characterAtIndex: p];
if (ch!=' ')
{
if(ch=='-')
{
ch='/';
}
NSString *appendString = [NSString stringWithFormat:@"%c",ch];
[formattedDate appendString:appendString];
p++;
}
else
{
break;
}
}
return formattedDate;
}