您好我使用自定义表格在表格视图中显示内容,而选择和取消选择时,我也使用附件检查
但是当我使用附件检查选择任何行时,自定义表中的View元素将向左侧移动。
我的自定义表格单元格如下所示。
选择表视图后看起来像这样
我查看THIS问题,但效果不佳。
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;
}