A Photo and Video Gallery

Overview

MHGallery

==================

MHGallery

bitcoin:1Lj45X69tPYAPqnZP2c9Ccs349fC2CEMQo

Podfile

platform :ios, '7.0'
pod 'MHVideoPhotoGallery'

Supported Videos

Youtube
Vimeo
Weblinks (.mov, .mp4, .mpv)

Supported Languages

DE,EN,ES,FR,HR,IT,PT,RU,DA,ZH-Hans

MHGalleryItem

+ (instancetype)itemWithURL:(NSString *)URLString thumbnailURL:(NSString*)thumbnailURL; //Thumbs are automatically generated for Videos. But you can set Thumb Images for GalleryTypeImage.
+ (instancetype)itemWithURL:(NSString*)URLString galleryType:(MHGalleryType)galleryType;
+ (instancetype)itemWithYoutubeVideoID:(NSString*)ID;
+ (instancetype)itemWithVimeoVideoID:(NSString*)ID;
+ (instancetype)itemWithImage:(UIImage*)image;

MHGalleryController

+(instancetype)galleryWithPresentationStyle:(MHGalleryViewMode)presentationStyle;

@property (nonatomic,assign) id<MHGalleryDelegate>              galleryDelegate;
@property (nonatomic,assign) id<MHGalleryDataSource>            dataSource;
@property (nonatomic,assign) BOOL                               autoplayVideos; //Default NO
@property (nonatomic,assign) NSInteger                          presentationIndex; //From which index you want to present the Gallery.
@property (nonatomic,strong) UIImageView                        *presentingFromImageView;
@property (nonatomic,strong) MHGalleryImageViewerViewController *imageViewerViewController;
@property (nonatomic,strong) MHOverviewController               *overViewViewController;
@property (nonatomic,strong) NSArray                            *galleryItems; //You can set an Array of GalleryItems or you can use the dataSource.
@property (nonatomic,strong) MHTransitionCustomization          *transitionCustomization; //Use transitionCustomization to Customize the GalleryControllers transitions
@property (nonatomic,strong) MHUICustomization                  *UICustomization; //Use UICustomization to Customize the GalleryControllers UI
@property (nonatomic,strong) MHTransitionPresentMHGallery       *interactivePresentationTransition;
@property (nonatomic,assign) MHGalleryViewMode                  presentationStyle;
@property (nonatomic,assign) UIStatusBarStyle                   preferredStatusBarStyleMH;

@property (nonatomic, copy) void (^finishedCallback)(NSUInteger currentIndex,UIImage *image,MHTransitionDismissMHGallery *interactiveTransition,MHGalleryViewMode viewMode);

UI Customization

@property (nonatomic)        UIBarStyle barStyle; //Default UIBarStyleDefault
@property (nonatomic,strong) UIColor *barTintColor; //Default nil
@property (nonatomic,strong) UIColor *barButtonsTintColor; //Default nil
@property (nonatomic,strong) UIColor *videoProgressTintColor; //Default Black
@property (nonatomic)        BOOL showMHShareViewInsteadOfActivityViewController; //Default YES
@property (nonatomic)        BOOL hideShare; //Default NO
@property (nonatomic)        BOOL useCustomBackButtonImageOnImageViewer; //Default YES
@property (nonatomic)        BOOL showOverView; //Default YES
@property (nonatomic)        MHBackButtonState backButtonState; //Default MHBackButtonStateWithBackArrow

@property (nonatomic,strong) UIBarButtonItem *customBarButtonItem; //A optional UIBarButtonItem displayed in the lower right corner. Default nil

@property (nonatomic,strong) UICollectionViewFlowLayout *overViewCollectionViewLayoutLandscape;
@property (nonatomic,strong) UICollectionViewFlowLayout *overViewCollectionViewLayoutPortrait;

-(void)setMHGalleryBackgroundColor:(UIColor*)color forViewMode:(MHGalleryViewMode)viewMode;
-(UIColor*)MHGalleryBackgroundColorForViewMode:(MHGalleryViewMode)viewMode;

Transition Customization

@property (nonatomic)       BOOL interactiveDismiss; //Default YES
@property (nonatomic)       BOOL dismissWithScrollGestureOnFirstAndLastImage;//Default YES
@property (nonatomic)       BOOL fixXValueForDismiss; //Default NO

Usage

UIImageView *imageView = [(ImageTableViewCell*)[tableView cellForRowAtIndexPath:indexPath] imageView];
        
MHGalleryItem *image1 = [MHGalleryItem itemWithURL:@"myImageURL" galleryType:MHGalleryTypeImage];
MHGalleryItem *image2 = [MHGalleryItem itemWithURL:@"myImageURL" galleryType:MHGalleryTypeImage];
MHGalleryItem *youtube = [MHGalleryItem itemWithYoutubeVideoID:@"myYoutubeID"];

NSArray *galleryData = @[image1,image2,youtube];
    
    MHGalleryController *gallery = [MHGalleryController galleryWithPresentationStyle:MHGalleryViewModeImageViewerNavigationBarShown];
gallery.galleryItems = galleryData;
gallery.presentingFromImageView = imageView;    
gallery.presentationIndex = indexPath.row;
        
__weak MHGalleryController *blockGallery = gallery;
       
gallery.finishedCallback = ^(NSUInteger currentIndex,UIImage *image,MHTransitionDismissMHGallery *interactiveTransition){
        
        NSIndexPath *newIndex = [NSIndexPath indexPathForRow:currentIndex inSection:0];
        
        [self.tableView scrollToRowAtIndexPath:newIndex atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            UIImageView *imageView = [(ImageTableViewCell*)[self.tableView cellForRowAtIndexPath:newIndex] iv];
            [blockGallery dismissViewControllerAnimated:YES dismissImageView:imageView completion:nil];
        });

    };    
[self presentMHGalleryController:gallery animated:YES completion:nil];

Dismiss Video (Like Paper App)

alt tag

Dismiss Image (Like Paper App)

alt tag

Dismiss at the end or start on ScrollDirection (Like Paper App)

alt tag

OverView interactive (dismiss & present)

alt tag

Share

alt tag

OverView

alt tag

Comments
  • setImageForMHGalleryItem:imageType:successBlock: unrecognized

    setImageForMHGalleryItem:imageType:successBlock: unrecognized

    Hi,

    I try to display an image with your gallery but i always have this error : -[UIImageView setImageForMHGalleryItem:imageType:successBlock:]: unrecognized selector sent to instance

    My code looks like this : capture decran 2014-06-05 a 18 32 11

    Any idea how I can fix this issue please ?

    opened by FlorianBasso 9
  • iOS 7.1 crashing on Done button while video is being show

    iOS 7.1 crashing on Done button while video is being show

    Hello,

    I'm encountering strange problem with some videos, from Youtube for now. First off the video thumbnail is not displayed, only grey background. After press video starts to load but it will not starts playing until play is pressed.

    When the button Done is pressed, thats when the crash occurs with following:

    *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

    Some of problematic Youtube videos:

    http://www.youtube.com/watch?v=l3HYLLruJis#t=52 http://www.youtube.com/watch?v=TpaQYSd75Ak#t=54

    opened by idikic 8
  • MHGalleryItem with Support for UIImage

    MHGalleryItem with Support for UIImage

    Hey, thanks for sharing your work. I really like it.

    The dataSource for a gallery always contains MHGalleryItems which rely on the url. My dataSource (NSMutableArray) is made up of several UIImages fetched by CoreData objects. Is it possible to extend "MHGalleryItem" to support direct use of UIImages? Or do I need to write them down to the filesystem in order to get the url?

    opened by mooseDev 7
  • Disable collection gallery

    Disable collection gallery

    How can I Disable collection gallery in this lib? I mean this collection: I tap on photo and I am in photoView, I tap back and I am in collection gallery. I want to go back to my VC then I tap this back. Is it possible?

    opened by bizibizi 6
  • Layout issue when sharing - landscape

    Layout issue when sharing - landscape

    steps to reproduce:

    1. open app. Choose local
    2. choose camera roll
    3. tap to open a thumb
    4. rotate to landscape
    5. tap to share there is an issue with the layout of the images

    screenshot: screen

    opened by mythodeia 4
  • Newbie question: use_frameworks + import?

    Newbie question: use_frameworks + import?

    Hi, I was able to successfully import MHVideoPhotoGallery via Cocoapods. However, I am having trouble importing the files:

    platform :ios, '8.0'
    use_frameworks!
    pod 'MHVideoPhotoGallery', '~> 2.0'
    

    I have these code but it isn't working, In the Project-Bridging-Header.h file, I have:

    #import <MMHVideoPhotoGallery/MHGallery.h>
    

    In the controllers, I also tried import MHGallery and that didn't work, Xcode complains No such module 'MHGallery'.

    Any suggestions? Is there a Swift version of the example project?

    opened by netwire88 3
  • Gallery Overview controller crashes on loading more than 200 images

    Gallery Overview controller crashes on loading more than 200 images

    I am using gallery MHGalleryDataSource methods to load images in gallery. When there are more than 200 images the overview controller is unable to load and crashes. For small number of images it works fine. Also I tried to resize image dynamically to 100x100 and it works fine. Only the original size images fails to load in overview controller.

    All my images are local images.

    Any solution?

    opened by macpraveen 3
  • Unnecessary import that causes client uses SDWebImage’s category even if he doesn’t want to

    Unnecessary import that causes client uses SDWebImage’s category even if he doesn’t want to

    I'm using AFNetworking and MHVideoPhotoGallery on my project, importing "UIImageView+AFNetworking.h" and "MHGallery.h" (UIImageView+WebCache.h) in the same file and both has the method:

    - (void)setImageWithURL:(NSURL *)url;
    

    My pull request #51 could solve it.

    opened by albsala 3
  • Fix analyzer warnings.

    Fix analyzer warnings.

    Hey Mario,

    this just fixes the warnings you get when you run the static analyzer in Xcode with cmd+shift+B. They are all false positives, your code was just fine before. Expressing it in a different way makes the static analyzer happy :).

    Best regards, Johannes

    opened by plu 3
  • Crash when dismissing Gallery on video

    Crash when dismissing Gallery on video

    Hello,

    I don't have the "why" of the crash (yet) but I can reproduce it.

    The crash happens after trying to play this (240p only) video: https://www.youtube.com/watch?v=sn_GCGJCxo8 After waiting a few seconds the video doesn't seem to load even though the time bar appears. If you try to dismiss the video at this point the app crash at line 183 of MHTransitionDismissMHGallery.m with Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

    Line 183 of MHTransitionDismissMHGallery.m is the last line of the following portion of code

    if (imageViewerCurrent.isPlayingVideo && imageViewerCurrent.moviePlayer) {
            self.moviePlayer = imageViewerCurrent.moviePlayer;
            [self.moviePlayer.view setFrame:AVMakeRectWithAspectRatioInsideRect(imageViewerCurrent.moviePlayer.naturalSize,fromViewController.view.bounds)];
    

    imageViewerCurrent.moviePlayer.naturalSize has a value of {0,0} in this situation, causing the exception.

    Other videos seem to work fine.

    opened by Bluezen 3
  • CALayer position contains NaN: [nan nan]

    CALayer position contains NaN: [nan nan]

    Hello Mario, I'm expiriencing some issues with iPhone 4/4s and iPad mini. CALayerInvalidGeometry. Stack trace bellow.

    I can't reproduce the error. Any ideas?

    Well your framework is really helpfull, so thanks anyway for hard work!!

    STACK TRACE:

    0   CoreFoundation  <redacted> + 130    
    1   libobjc.A.dylib objc_exception_throw + 38   
    2   CoreFoundation  <redacted> + 0  
    3   QuartzCore  <redacted> + 242    
    4   QuartzCore  <redacted> + 54 
    5   QuartzCore  <redacted> + 594    
    6   UIKit   <redacted> + 254    
    7   UIKit   <redacted> + 184    
    8   UIKit   <redacted> + 38 
    9       -[MHUIImageViewContentViewAnimation setFrame:] (MHUIImageViewContentViewAnimation.m:152) + 3271561  
    10      -[MHTransitionDismissMHGallery startInteractiveTransition:] (MHTransitionDismissMHGallery.m:156) + 3209077  
    11  UIKit   <redacted> + 1254   
    12  UIKit   <redacted> + 316    
    13  UIKit   <redacted> + 430    
    14  CoreFoundation  <redacted> + 20 
    15  CoreFoundation  <redacted> + 284    
    16  CoreFoundation  <redacted> + 730    
    17  CoreFoundation  CFRunLoopRunSpecific + 522  
    18  CoreFoundation  CFRunLoopRunInMode + 106    
    19  GraphicsServices    GSEventRunModal + 138   
    20  UIKit   UIApplicationMain + 1136    
    21          main (main.m:16) + 146983   
    22  libdyld.dylib   <redacted> + 2
    

    Have a nice day

    Ivan

    opened by idikic 3
  • Crash issue with latest Facebook SDK

    Crash issue with latest Facebook SDK

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SFAuthenticationViewController viewControllers]: unrecognized selector sent to instance... Getting this error While try to login Via Facebook.

    UINavigationController nav = (UINavigationController)presented;

    It crashes at this line in "MHGalleryController" Is there any solution?

    opened by NiharikaRaj 0
  • MHShareViewController layout issue

    MHShareViewController layout issue

    The animation on the MHShareViewController to resize photos in the share view is corrupted on iOS 11. the select boxes are out of the bounds. This can be seen in the provided examples. tap on an image then click on share button.

    opened by bijan-usf 0
  • App rejection

    App rejection

    I've got app rejection with motivation:

    Your app uses or references the following non-public APIs:

    UIScrollViewDelayedTouchesBeganGestureRecognizer, UIScrollViewPanGestureRecognizer, [UIView origin]

    There is only one place where I can find 'UIScrollViewDelayedTouchesBeganGestureRecognizer' and 'UIScrollViewPanGestureRecognizer' is in MHGalleryImageViewerViewController. What can I do with it?

    opened by Dalein 0
  • Added strong MHUICustomization.h/MHUICustomization

    Added strong MHUICustomization.h/MHUICustomization

    It gives warning because MHUICustomization object did not have strong declaration.. This can be eliminated by changing the warning settings.

    @property (nonatomic) NSDictionary *descriptionLinkAttributes; @property (nonatomic) NSDictionary *descriptionActiveLinkAttributes; @property (nonatomic) NSAttributedString *descriptionTruncationString;

    opened by chamira 1
Owner
Mario Hahn
Mario Hahn
A fully functional short video app project.Record a six secends video while playing prank sounds.

prankPro A fully functional short video app project How to Install 1. use coconapod to init your xcode environment. 2. change the app-keys in `applica

huijimuhe 258 Jun 19, 2022
JDVideoKit - You can easily transfer your video into Three common video type.

JDVideoKit Introduction You can easily transfer your video into Three common video type. You can use set up camera easily. Installation pod 'JDVideoK

郭介騵 24 Sep 9, 2021
A Swift library to upload video files to api.video platform.

api.video IOS video uploader api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and manag

api.video 7 Dec 9, 2022
api.video is the video infrastructure for product builders

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

api.video 4 Jun 27, 2022
High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

High-performance and flexible video editing and effects framework, based on AVFoundation and Metal.

BearRuan 650 Dec 30, 2022
Yattee: video player for Invidious and Piped built for iOS 15, tvOS 15 and macOS Monterey

Video player with support for Invidious and Piped instances built for iOS 15, tvOS 15 and macOS Monterey.

Yattee 1k Dec 27, 2022
Yattee: video player for Invidious and Piped built for iOS, tvOS and macOS

Video player for Invidious and Piped instances built for iOS, tvOS and macOS. Features Native user interface built with SwiftUI Multiple instances and

Yattee 1.1k Jan 8, 2023
A video composition framework build on top of AVFoundation. It's simple to use and easy to extend.

A high-level video composition framework build on top of AVFoundation. It's simple to use and easy to extend. Use it and make life easier if you are implementing video composition feature.

VideoFlint 1.4k Dec 25, 2022
▶️ video player in Swift, simple way to play and stream media on iOS/tvOS

Player Player is a simple iOS video player library written in Swift. Looking for an obj-c video player? Check out PBJVideoPlayer (obj-c). Looking for

patrick piemonte 2k Jan 2, 2023
A set of tools to trim, crop and select frames inside a video

PryntTrimmerView A set of tools written in swift to crop and trim videos. Example To run the example project, clone the repo, and run pod install from

Henry Huck 742 Jan 5, 2023
Repository with base samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Includes steps for encoding and packaging your own test content.

Video Everything Repository with minimal samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Content and License All t

Alex Dodge 3 Jul 4, 2021
📽 A video player for SwiftUI, support for caching, preload and custom control view.

Features QuickStart Advances Installation Requirements License Demo Clone or download the project. In the terminal, run swift package resolve. Open Vi

Gesen 437 Jan 5, 2023
Swift Package used for video where I demonstrate how to extract a package to a local framework and modify it.

SegmentedPicker NOTE: This sample code is taken from the article by Frank Jia in his article titled Build a Custom iOS Segmented Control With SwiftUI

Stewart Lynch 1 Oct 11, 2021
iOS video player for trailer. You can customize layout for the control panel. Support PiP and DRM.

iOS video player for trailer. You can customize layout for the control panel. Support PiP and DRM.

Abe Wang 11 Nov 7, 2022
YouTube video player for iOS, tvOS and macOS

About XCDYouTubeKit is a YouTube video player for iOS, tvOS and macOS. Are you enjoying XCDYouTubeKit? You can say thank you with a tweet. I am also a

Cédric Luthi 2.9k Jan 7, 2023
Paging Video UI, and some control components is available.

VideoPager [![CI Status](http://img.shields.io/travis/Takuya Okamoto/VideoPager.svg?style=flat)](https://travis-ci.org/Takuya Okamoto/VideoPager) Demo

Takuya Okamoto 55 Dec 23, 2022
YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI for easily create a Youtube app

YoutubeKit YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI to easily create Youtube applications. Important Ref

Ryo Ishikawa 555 Dec 28, 2022
Versatile Video Player implementation for iOS, macOS, and tvOS

News ?? - Since 2.1.3 VersaPlayer now supports iOS, macOS, and tvOS Example Installation Usage Basic Usage Adding Controls Advanced Usage Encrypted Co

Jose Quintero 723 Dec 26, 2022
An iOS application 📱 that extracts text real time using camera 📷 and play relevant video from the text

CHARUSAT-SceW It is an iOS application ?? that scans and extracts text real-time through camera ?? , if it is detected. It will play relevent video fr

Vatsal Patel 2 Nov 15, 2021