在UICollectionViewController中使用segue时出错

时间:2014-08-03 21:00:09

标签: ios objective-c xcode uicollectionview

使用 didSelectItemAtIndexPath 方法进入 CollectionViewController 以在StoryBoards中调用segue时遇到问题。

这是执行我的应用时的错误。

 nested push animation can result in corrupted navigation bar
 2014-08-03 16:31:43.292 Geelbe[2050:607] Finishing up a navigation transition in an unexpected    state. Navigation Bar subview tree might get corrupted.

这就是方法。

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    //Getting Item Selected.
    KidsGrid *itemSelected = [grid_kid objectAtIndex:indexPath.row]; //getting s
    self.currentItem = itemSelected;
    [self performSegueWithIdentifier:@"gridDetail" sender:self];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    //Configure Kids Detail View Controller
    [(ManDetailGridViewController *)segue.destinationViewController setCurrentItem:self.currentItem];
}

任何想法?

1 个答案:

答案 0 :(得分:1)

尝试删除第一种方法中的所有代码。

在第二种方法中写:

if ([segue.identifier isEqualToString:@"gridDetail"]) {
        UICollectionViewCell *cell = sender;
        NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];
        KidsGrid *itemSelected = [grid_kid objectAtIndex:indexPath.row]; //getting s

        self.currentItem = itemSelected;

        [(ManDetailGridViewController *)segue.destinationViewController setCurrentItem:self.currentItem];
}