显示附件复选标记视图移动表格查看内容

时间:2016-08-07 05:51:51

标签: ios objective-c uitableview

您好我使用自定义表格在表格视图中显示内容,而选择取消选择时,我也使用附件检查

但是当我使用附件检查选择任何行时,自定义表中的View元素将向左侧移动。

我的自定义表格单元格如下所示。

enter image description here

选择表视图后看起来像这样

enter image description here

我查看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;
}

0 个答案:

没有答案