0

Good day! i have uicollectionview, in cells are showing different documents... is it possible to design pushing cell and show different view controllers depends on cell(document) type?

Alex Kraev
  • 199
  • 1
  • 12

1 Answers1

0

Assuming that your UICollectionViewCell is aware of which document it is supposed to show, you can use that information to discriminate between documents once you leave the view. Control-drag from your cell to the new view controller in Interface Builder and implement the distinction in prepareForSegue

-(void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender {
   if ([segue.identifier isEqualToString:@"ShowDetailController"]) {
        MyDetailViewController *destination = segue.destinationViewController;
        UICollectionViewCell *cell = (UICollectionViewCell*)sender;
        // depending on your cell implementation, e.g. with an enum
        destination.documentType = cell.documentType;
   }
}
Mundi
  • 79,884
  • 17
  • 117
  • 140
  • So to designing different pushing is not possible in storyboard... Mundi's true code allows to control filling of view controller. That is pattern factory =) – Alex Kraev Nov 04 '13 at 19:22
  • It is possible. But the above is preferable. – Mundi Nov 04 '13 at 19:59