这是indexloc提供的服务,不要输入任何密码
Skip to content

sisufo/MHVideoPhotoGallery

Repository files navigation

MHVideoPhotoGallery

OverView

alt tag

Dismiss

alt tag

Share

alt tag

Play Videos

alt tag

Setup

self.imageViewForPresentingMHGallery = [(MHGalleryOverViewCell*)[collectionView cellForItemAtIndexPath:indexPath] iv];

NSArray *galleryData = self.galleryDataSource[indexPath.section];

[[MHGallerySharedManager sharedManager] presentMHGalleryWithItems:galleryData
                                                         forIndex:indexPath.row
                                         andCurrentViewController:self
                                                   finishCallback:^(NSInteger pageIndex,AnimatorShowDetailForDismissMHGallery *interactiveTransition) {
                                                       self.interactive = interactiveTransition;
                                                       [self dismissGalleryForIndexPath:[NSIndexPath indexPathForRow:pageIndex inSection:0]
                                                                      andCollectionView:collectionView];
                                                       
                                                   }
                                         withImageViewTransiation:YES];

Presenting

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                              presentingController:(UIViewController *)presenting
                                                                  sourceController:(UIViewController *)source {
     AnimatorShowDetailForPresentingMHGallery *detail = [AnimatorShowDetailForPresentingMHGallery new];
     detail.iv = self.imageViewForPresentingMHGallery;
    return detail;
}

Dismiss

-(id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed{
     AnimatorShowDetailForDismissMHGallery *detail = [AnimatorShowDetailForDismissMHGallery new];
     detail.iv = self.imageViewForPresentingMHGallery;
     return detail;
}
-(id<UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id<UIViewControllerAnimatedTransitioning>)animator{
     if ([animator isKindOfClass:[AnimatorShowDetailForDismissMHGallery class]]) {
         return self.interactive;
     }else {
           return nil;
     }
}

-(void)dismissGalleryForIndexPath:(NSIndexPath*)indexPath
            andCollectionView:(UICollectionView*)collectionView{
     CGRect cellFrame  = [[collectionView collectionViewLayout] layoutAttributesForItemAtIndexPath:indexPath].frame;
     [collectionView scrollRectToVisible:cellFrame
                           animated:NO];

        dispatch_async(dispatch_get_main_queue(), ^{
          [collectionView reloadItemsAtIndexPaths:@[indexPath]];
         self.imageViewForPresentingMHGallery = [(MHGalleryOverViewCell*)[collectionView cellForItemAtIndexPath:indexPath] iv];
            if (self.interactive) {
               self.interactive.iv = self.imageViewForPresentingMHGallery;
         }
         [self dismissViewControllerAnimated:YES completion:nil];
});

}

About

A Photo and Video Gallery designed for iOS 7.

Resources

License

Stars

Watchers

Forks

Packages

No packages published