Josué H.
Josué H.

Reputation: 1191

Error when use segue in UICollectionViewController

I have a problem when use didSelectItemAtIndexPath method into CollectionViewController to call segue in StoryBoards.

This is the error when execute my app.

 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.

And this is the methods.

-(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];
}

Any Idea?

Upvotes: 1

Views: 64

Answers (1)

ppalancica
ppalancica

Reputation: 4277

Try to remove all the code in the 1-st method.

In the 2-nd method write:

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];
}

Upvotes: 1

Related Questions