我有一个iOS应用程序,其中有几个UITableViews,其中所有这些应用程序均按预期工作 。我升级的应用程序来处理iOS8UITableView didSelectRowAtIndexPath升级到iOS8后无法正常工作
因为那时我有一个加载自定义单元格到表视图谁的笔尖在ib中勾选'使用自动布局'的问题。然后我取消所有这些在我的自定义单元格中的选中,从那以后,我所有UITableViews的单元格不仅不调用didSelectRowAtIndex路径方法,而且在触摸时不突出显示。
我必须检查所有活动单元的加入
if(cell.userInteractionEnabled){NSLog(@"is enabled");}else{NSLog(@"is not enabled");}
所有装载的细胞的写上“允许”到日志
我通过IB设置委托和数据源在故事板中,所有这些工作都在我改变“使用自动布局”并升级到在iOS 8上运行之前。
我错过了什么?
这里是我的代码来创建细胞
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"TableCellWithNumberCellIdentifier";
if(events.count>indexPath.row &&[[[events objectAtIndex:indexPath.row] objectForKey:@"tag"] integerValue] == -1)
{
EventsMonthSeparator *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell.translatesAutoresizingMaskIntoConstraints=NO;
cell = (EventsMonthSeparator *)[EventsMonthSeparator cellFromNibNamed:@"EventsMonthSeparator"];
cell.date.text=[[events objectAtIndex:indexPath.row] objectForKey:@"date"];
[Functions setFontFamily:@"Neutra Display" forView:cell andSubView:YES];
if(cell.userInteractionEnabled){NSLog(@"is enabled");}else{NSLog(@"is not enabled");}
}
return cell;
}else
{
eventsRow *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell.translatesAutoresizingMaskIntoConstraints=NO;
cell = (eventsRow *)[eventsRow cellFromNibNamed:@"eventsRow"];
cell.description.text=[[events objectAtIndex:indexPath.row] objectForKey:@"name"];
cell.timedate.text=[[events objectAtIndex:indexPath.row]objectForKey:@"date"];
cell.image.image=[UIImage imageNamed:@"tiledrinks"];
cell.status.text=[Functions statusForIndex:[[[events objectAtIndex:indexPath.row] objectForKey:@"booked"] intValue]];
[Functions setFontFamily:@"Neutra Display" forView:cell andSubView:YES];
cell.tag=1;
[cell setSelectionStyle:UITableViewCellSelectionStyleBlue];
if(cell.userInteractionEnabled){NSLog(@"is enabled");}else{NSLog(@"is not enabled");}
}
return cell;
}
}
什么问题,你是否也有加载自定义单元格与自动布局表视图打开?解决这个问题会更好,并继续使用apt布局。 – rdelmar 2014-10-18 23:19:32
当它被打开它完美的工作 – 2014-10-19 08:05:35