Hi I am using custom Table to display content in table view and while selecting and deselection, i am also using accessory check
But when I select any row using accessory check, The View elements in custom table Gets move towards Left side.
My Custom Table Cell Look like this.
After Selection Table View Look Like this
I check The THIS question but it s not working well.
My Code for cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PackageTableCell *cell = (PackageTableCell *)[tableView dequeueReusableCellWithIdentifier:packageCell];
if (cell == nil)
{
cell = [[PackageTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:packageCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
JobAndPackDetails *obj =[self.arrayOfJobList objectAtIndex:indexPath.row];
[cell.lblJobName setText:obj.jobName];
[cell.lblJobDescription setText:obj.jobDesc];
[cell.lblJobType setText:obj.jobType];
[cell.lblJobSK setText:[NSString stringWithFormat:@"%.0f",obj.jobSK]];
[cell.imgVehicle setImage:[UIImage imageNamed:@"placeholder.png"]];
cell.OuterVIEW .autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:cell.OuterVIEW];
if ([obj.jobType isEqualToString:@"JPK"]){
[cell.imgJPK setImage:[UIImage imageNamed:@"vs_package.png"]];
}else{
[cell.imgJPK setImage:nil];
}
if ([array_SelectedRows containsObject:indexPath] || (([[self.arrayJob_Package valueForKey:@"JobTypeSK"] containsObject:[NSString stringWithFormat:@"%.0f",obj.jobSK]]&& [[self.arrayJob_Package valueForKey:@"JobType"] containsObject:obj.jobType])&&self.isCalledFromBookAppointment))
{
cell.accessoryType = UITableViewCellAccessoryCheckmark ;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone ;
}
return cell;
}