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?
Asked
Active
Viewed 67 times
0
-
what do you mean by "design pushing cell"? – ManicMonkOnMac Nov 01 '13 at 16:35
-
thanks for answering=) it means not to use code where i should analyze what type of cell user picked and then choose nib for this cell but design it on springboard=) – Alex Kraev Nov 01 '13 at 19:49
-
Can you please add more description to your question? by design it on springboard you mean interface builder/storyboard? – ManicMonkOnMac Nov 01 '13 at 20:03
-
yes) i mean to design all storyboard segue for nibs in IB... – Alex Kraev Nov 01 '13 at 20:21
1 Answers
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
-