문제

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?

도움이 되었습니까?

해결책

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;
   }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top