我的数据(玩家)的矩阵显示的UICollectionView
。 我想对一个球员的细节在酥料饼的视图当用户触摸单元格中显示。 我问这个问题前面 ,并得到它的工作。 但此后,一个奇怪的问题制定。
当我触摸一个细胞,出现酥料饼,但主要观点解开两个屏幕和应用程序崩溃,出现此错误:“由于未捕获的异常终止应用程序‘NSGenericException’,原因是:”(!?) - [UIPopoverController的dealloc]达到,而酥料饼仍然可见。”
该playerDataView是建立在故事板。 我宣布双方playerDataView控制器和酥料饼的视图控制器作为其头文件集合视图的属性:
@property (strong, nonatomic) UIPopoverController *playerDataPopover;
@property (strong, nonatomic) SWSPlayerDataViewController *playerDataView;
下面是实例化酥料饼的代码:
- (IBAction)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0 || indexPath.section == 0) { // Ignores user selecting row or column headers that I've placed in the collection view data
return;
}
[self.collectionView deselectItemAtIndexPath:indexPath animated:NO];
CGRect anchorRect = [collectionView layoutAttributesForItemAtIndexPath:indexPath].frame;
self.playerDataView = [self.storyboard instantiateViewControllerWithIdentifier:@"playerDataView"];
self.playerDataView.player = self.players[indexPath.section][indexPath.row]; // Sets player data in popover view.
self.playerDataPopover = [[UIPopoverController alloc] initWithContentViewController:self.playerDataView];
[self.playerDataPopover presentPopoverFromRect:anchorRect inView:self.collectionView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
我能理解为什么我会得到这个错误,如果有从集合视图开卷,但我不明白,为什么开卷发生。 有任何想法吗?