diff --git a/MHVideoPhotoGallery.podspec b/MHVideoPhotoGallery.podspec index 0b8482d..ee17324 100644 --- a/MHVideoPhotoGallery.podspec +++ b/MHVideoPhotoGallery.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MHVideoPhotoGallery' - s.version = '2.1.3' + s.version = '2.1.4' s.license = 'MIT' s.homepage = 'https://github.com/mariohahn/MHVideoPhotoGallery' s.author = { @@ -9,8 +9,8 @@ Pod::Spec.new do |s| s.summary = 'Gallery for iOS 7 Devices.' s.platform = :ios s.source = { - :git => 'https://github.com/mariohahn/MHVideoPhotoGallery.git', - :tag => 'v2.1.3' + :git => 'https://github.com/vibe0508/MHVideoPhotoGallery.git', + :tag => 'v2.1.4' } s.dependency 'SDWebImage' @@ -24,4 +24,4 @@ Pod::Spec.new do |s| s.source_files = ['MHVideoPhotoGallery/MMHVideoPhotoGallery/**/*.{h,m}'] s.ios.deployment_target = '7.0' s.requires_arc = true -end \ No newline at end of file +end diff --git a/MHVideoPhotoGallery.xcodeproj/project.pbxproj b/MHVideoPhotoGallery.xcodeproj/project.pbxproj index d032b19..3f60178 100644 --- a/MHVideoPhotoGallery.xcodeproj/project.pbxproj +++ b/MHVideoPhotoGallery.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - CCE50708F0B1B954A1D43543 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 48BEA0714A525E3C516EBDBD /* libPods.a */; }; + 914975EDCD2CBBF7C8288BC7 /* libPods-MHVideoPhotoGallery.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDF7702A0A93ACA6C5441553 /* libPods-MHVideoPhotoGallery.a */; }; F514263518911D8E0091E3DF /* 707-albums-selected.png in Resources */ = {isa = PBXBuildFile; fileRef = F514263318911D8E0091E3DF /* 707-albums-selected.png */; }; F514263618911D8E0091E3DF /* 707-albums-selected@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F514263418911D8E0091E3DF /* 707-albums-selected@2x.png */; }; F514263918911D920091E3DF /* 705-photos-selected.png in Resources */ = {isa = PBXBuildFile; fileRef = F514263718911D920091E3DF /* 705-photos-selected.png */; }; @@ -108,9 +108,13 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 48BEA0714A525E3C516EBDBD /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 7034C256C78A0FAB4D812A2B /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; - A1831E23B84EF67E23139C0E /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 1275C4CE8C1CA45FB4B7FCBC /* Pods-MHVideoPhotoGallery.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MHVideoPhotoGallery.release.xcconfig"; path = "Pods/Target Support Files/Pods-MHVideoPhotoGallery/Pods-MHVideoPhotoGallery.release.xcconfig"; sourceTree = ""; }; + 7C603BB9E1AAF8E1BD47840D /* Pods-MHVideoPhotoGallery.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MHVideoPhotoGallery.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MHVideoPhotoGallery/Pods-MHVideoPhotoGallery.debug.xcconfig"; sourceTree = ""; }; + DABACC5D1E45331F00602E1B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + DABACC5E1E45332100602E1B /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = ""; }; + DABACC5F1E45332300602E1B /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + DABACC601E45332700602E1B /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; + DDF7702A0A93ACA6C5441553 /* libPods-MHVideoPhotoGallery.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MHVideoPhotoGallery.a"; sourceTree = BUILT_PRODUCTS_DIR; }; F514263318911D8E0091E3DF /* 707-albums-selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "707-albums-selected.png"; sourceTree = ""; }; F514263418911D8E0091E3DF /* 707-albums-selected@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "707-albums-selected@2x.png"; sourceTree = ""; }; F514263718911D920091E3DF /* 705-photos-selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "705-photos-selected.png"; sourceTree = ""; }; @@ -126,7 +130,6 @@ F53F924517EB008100A9FE6A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; F53F924717EB008100A9FE6A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; F53F924B17EB008100A9FE6A /* MHVideoPhotoGallery-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MHVideoPhotoGallery-Info.plist"; sourceTree = ""; }; - F53F924D17EB008100A9FE6A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; F53F924F17EB008100A9FE6A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; F53F925117EB008100A9FE6A /* MHVideoPhotoGallery-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MHVideoPhotoGallery-Prefix.pch"; sourceTree = ""; }; F53F925217EB008100A9FE6A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -222,11 +225,8 @@ F5D24FFC1885CDDD004D97CA /* ExampleViewControllerTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleViewControllerTableView.m; sourceTree = ""; }; F5D24FFE1885D3D7004D97CA /* ExampleViewControllerImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExampleViewControllerImageView.h; sourceTree = ""; }; F5D24FFF1885D3D7004D97CA /* ExampleViewControllerImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleViewControllerImageView.m; sourceTree = ""; }; - F5D9AB4918B61E390014AAC6 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = ""; }; F5D9AB4A18B61E390014AAC6 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = ""; }; - F5D9AB4B18B6220C0014AAC6 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; F5D9AB4C18B6220C0014AAC6 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; - F5D9AB4E18B6658A0014AAC6 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; F5D9AB4F18B6658A0014AAC6 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; F5D9AB5018B665A80014AAC6 /* MHGallery.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = MHGallery.bundle; path = MMHVideoPhotoGallery/MHGallery.bundle; sourceTree = ""; }; F5DBBF2C187D582000BEFE29 /* MHUIImageViewContentViewAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MHUIImageViewContentViewAnimation.h; path = MMHVideoPhotoGallery/MHUIImageViewContentViewAnimation/MHUIImageViewContentViewAnimation.h; sourceTree = ""; }; @@ -248,7 +248,7 @@ F53F924617EB008100A9FE6A /* CoreGraphics.framework in Frameworks */, F53F924817EB008100A9FE6A /* UIKit.framework in Frameworks */, F53F924417EB008100A9FE6A /* Foundation.framework in Frameworks */, - CCE50708F0B1B954A1D43543 /* libPods.a in Frameworks */, + 914975EDCD2CBBF7C8288BC7 /* libPods-MHVideoPhotoGallery.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -265,11 +265,11 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 64EBA583430CC00734798E3D /* Pods */ = { + 48ED43EAF27151C800B9609A /* Pods */ = { isa = PBXGroup; children = ( - 7034C256C78A0FAB4D812A2B /* Pods.debug.xcconfig */, - A1831E23B84EF67E23139C0E /* Pods.release.xcconfig */, + 7C603BB9E1AAF8E1BD47840D /* Pods-MHVideoPhotoGallery.debug.xcconfig */, + 1275C4CE8C1CA45FB4B7FCBC /* Pods-MHVideoPhotoGallery.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -281,7 +281,7 @@ F53F926817EB008100A9FE6A /* MHVideoPhotoGalleryTests */, F53F924217EB008100A9FE6A /* Frameworks */, F53F924117EB008100A9FE6A /* Products */, - 64EBA583430CC00734798E3D /* Pods */, + 48ED43EAF27151C800B9609A /* Pods */, ); sourceTree = ""; }; @@ -303,7 +303,7 @@ F53F924517EB008100A9FE6A /* CoreGraphics.framework */, F53F924717EB008100A9FE6A /* UIKit.framework */, F53F926217EB008100A9FE6A /* XCTest.framework */, - 48BEA0714A525E3C516EBDBD /* libPods.a */, + DDF7702A0A93ACA6C5441553 /* libPods-MHVideoPhotoGallery.a */, ); name = Frameworks; sourceTree = ""; @@ -608,12 +608,12 @@ isa = PBXNativeTarget; buildConfigurationList = F53F927217EB008100A9FE6A /* Build configuration list for PBXNativeTarget "MHVideoPhotoGallery" */; buildPhases = ( - 75DDE8B2C1B33F486A5B8488 /* Check Pods Manifest.lock */, + 6D82B4507816821052C7125C /* [CP] Check Pods Manifest.lock */, F53F923C17EB008100A9FE6A /* Sources */, F53F923D17EB008100A9FE6A /* Frameworks */, F53F923E17EB008100A9FE6A /* Resources */, - 0C519C9D844EB0B45067DB4C /* Embed Pods Frameworks */, - 87746AA85625C06CC49A954C /* Copy Pods Resources */, + 154DE1A8AB3006705A727A0A /* [CP] Embed Pods Frameworks */, + DFD69ABFEC3ABB13B89F14B1 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -748,49 +748,52 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0C519C9D844EB0B45067DB4C /* Embed Pods Frameworks */ = { + 154DE1A8AB3006705A727A0A /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MHVideoPhotoGallery/Pods-MHVideoPhotoGallery-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 75DDE8B2C1B33F486A5B8488 /* Check Pods Manifest.lock */ = { + 6D82B4507816821052C7125C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "Check Pods Manifest.lock"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-MHVideoPhotoGallery-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 87746AA85625C06CC49A954C /* Copy Pods Resources */ = { + DFD69ABFEC3ABB13B89F14B1 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MHVideoPhotoGallery/Pods-MHVideoPhotoGallery-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -854,10 +857,10 @@ F53F924C17EB008100A9FE6A /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - F53F924D17EB008100A9FE6A /* en */, - F5D9AB4918B61E390014AAC6 /* de */, - F5D9AB4B18B6220C0014AAC6 /* fr */, - F5D9AB4E18B6658A0014AAC6 /* es */, + DABACC5D1E45331F00602E1B /* en */, + DABACC5E1E45332100602E1B /* de */, + DABACC5F1E45332300602E1B /* fr */, + DABACC601E45332700602E1B /* es */, ); name = InfoPlist.strings; sourceTree = ""; @@ -949,7 +952,7 @@ }; F53F927317EB008100A9FE6A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7034C256C78A0FAB4D812A2B /* Pods.debug.xcconfig */; + baseConfigurationReference = 7C603BB9E1AAF8E1BD47840D /* Pods-MHVideoPhotoGallery.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; @@ -969,7 +972,7 @@ }; F53F927417EB008100A9FE6A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A1831E23B84EF67E23139C0E /* Pods.release.xcconfig */; + baseConfigurationReference = 1275C4CE8C1CA45FB4B7FCBC /* Pods-MHVideoPhotoGallery.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; diff --git a/MHVideoPhotoGallery/ExampleViewControllerCollectionViewInTableView.m b/MHVideoPhotoGallery/ExampleViewControllerCollectionViewInTableView.m index 5b01287..02c047c 100644 --- a/MHVideoPhotoGallery/ExampleViewControllerCollectionViewInTableView.m +++ b/MHVideoPhotoGallery/ExampleViewControllerCollectionViewInTableView.m @@ -93,7 +93,7 @@ - (void)viewDidLoad tailored.attributedTitle = title; tailored2.attributedString = string2; - self.galleryDataSource = @[@[tailored,tailored2]]; + self.galleryDataSource = @[@[tailored,tailored2, tailored3]]; self.tableView.backgroundColor = [UIColor colorWithRed:0.83 green:0.84 blue:0.86 alpha:1]; [self.tableView reloadData]; diff --git a/MHVideoPhotoGallery/ExampleViewControllerTableView.m b/MHVideoPhotoGallery/ExampleViewControllerTableView.m index 6dc4aaf..91009c8 100644 --- a/MHVideoPhotoGallery/ExampleViewControllerTableView.m +++ b/MHVideoPhotoGallery/ExampleViewControllerTableView.m @@ -8,6 +8,7 @@ #import "ExampleViewControllerTableView.h" #import "MHOverviewController.h" +#import "MHCustomization.h" #import "UIImageView+WebCache.h" @implementation ImageTableViewCell @@ -28,10 +29,13 @@ - (void)viewDidLoad - MHGalleryItem *tailored = [[MHGalleryItem alloc]initWithURL:@"http://www.tailored-apps.com/wp-content/uploads/2014/01/wien_cropped-350x300.jpg" - galleryType:MHGalleryTypeImage]; + MHGalleryItem *tailored = [MHGalleryItem.alloc initWithURL:@"http://www.tailored-apps.com/wp-content/uploads/2014/01/wien_cropped-350x300.jpg" + galleryType:MHGalleryTypeImage]; - self.galleryDataSource = @[tailored]; + MHGalleryItem *tailored2 = [MHGalleryItem.alloc initWithURL:@"http://www.tailored-apps.com/wp-content/uploads/2014/01/hannes.jpg" + galleryType:MHGalleryTypeImage]; + + self.galleryDataSource = @[tailored, tailored2]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ @@ -69,6 +73,10 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath * gallery.presentingFromImageView = imageView; gallery.presentationIndex = indexPath.row; + MHUICustomization *customization = [MHUICustomization new]; + customization.showMiniViews = YES; + gallery.UICustomization = customization; + __weak MHGalleryController *blockGallery = gallery; gallery.finishedCallback = ^(NSInteger currentIndex,UIImage *image,MHTransitionDismissMHGallery *interactiveTransition,MHGalleryViewMode viewMode){ diff --git a/MHVideoPhotoGallery/Images.xcassets/705-photos-selected.imageset/Contents.json b/MHVideoPhotoGallery/Images.xcassets/705-photos-selected.imageset/Contents.json index 4bc3a8f..5ecdbdf 100644 --- a/MHVideoPhotoGallery/Images.xcassets/705-photos-selected.imageset/Contents.json +++ b/MHVideoPhotoGallery/Images.xcassets/705-photos-selected.imageset/Contents.json @@ -2,13 +2,17 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x", - "filename" : "705-photos-selected.png" + "filename" : "705-photos-selected.png", + "scale" : "1x" }, { "idiom" : "universal", - "scale" : "2x", - "filename" : "705-photos-selected@2x.png" + "filename" : "705-photos-selected@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" } ], "info" : { diff --git a/MHVideoPhotoGallery/Images.xcassets/707-albums-selected.imageset/Contents.json b/MHVideoPhotoGallery/Images.xcassets/707-albums-selected.imageset/Contents.json index 8fdd97c..7f448cf 100644 --- a/MHVideoPhotoGallery/Images.xcassets/707-albums-selected.imageset/Contents.json +++ b/MHVideoPhotoGallery/Images.xcassets/707-albums-selected.imageset/Contents.json @@ -2,13 +2,17 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x", - "filename" : "707-albums-selected.png" + "filename" : "707-albums-selected.png", + "scale" : "1x" }, { "idiom" : "universal", - "scale" : "2x", - "filename" : "707-albums-selected@2x.png" + "filename" : "707-albums-selected@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" } ], "info" : { diff --git a/MHVideoPhotoGallery/Images.xcassets/750-home-selected.imageset/Contents.json b/MHVideoPhotoGallery/Images.xcassets/750-home-selected.imageset/Contents.json index 43fd08f..69e9c76 100644 --- a/MHVideoPhotoGallery/Images.xcassets/750-home-selected.imageset/Contents.json +++ b/MHVideoPhotoGallery/Images.xcassets/750-home-selected.imageset/Contents.json @@ -2,13 +2,17 @@ "images" : [ { "idiom" : "universal", - "scale" : "1x", - "filename" : "750-home-selected.png" + "filename" : "750-home-selected.png", + "scale" : "1x" }, { "idiom" : "universal", - "scale" : "2x", - "filename" : "750-home-selected@2x.png" + "filename" : "750-home-selected@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" } ], "info" : { diff --git a/MHVideoPhotoGallery/Images.xcassets/AppIcon.appiconset/Contents.json b/MHVideoPhotoGallery/Images.xcassets/AppIcon.appiconset/Contents.json index 213e07f..b8926e0 100644 --- a/MHVideoPhotoGallery/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/MHVideoPhotoGallery/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -12,12 +22,22 @@ "filename" : "Icon-Small@2x.png", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon-Spotlight-40@2x.png", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, { "size" : "57x57", "idiom" : "iphone", @@ -36,6 +56,21 @@ "filename" : "Icon-60@2x.png", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -92,6 +127,11 @@ "idiom" : "ipad", "filename" : "Icon-76@2x.png", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" } ], "info" : { diff --git a/MHVideoPhotoGallery/Launch Screen.storyboard b/MHVideoPhotoGallery/Launch Screen.storyboard index 8c0d1c8..c71f2d3 100644 --- a/MHVideoPhotoGallery/Launch Screen.storyboard +++ b/MHVideoPhotoGallery/Launch Screen.storyboard @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -15,26 +19,23 @@ - + - - + diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.h b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.h index b4cbf1c..46c24d2 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.h +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.h @@ -37,6 +37,7 @@ typedef NS_ENUM(NSUInteger, MHBackButtonState) { @property (nonatomic) BOOL hideShare; //Default NO @property (nonatomic) BOOL useCustomBackButtonImageOnImageViewer; //Default YES @property (nonatomic) BOOL showOverView; //Default YES +@property (nonatomic) BOOL showMiniViews; //Default NO @property (nonatomic) MHBackButtonState backButtonState; //Default MHBackButtonStateWithBackArrow @property (nonatomic,strong) UIBarButtonItem *customBarButtonItem; //A optional UIBarButtonItem displayed in the lower right corner. Default nil diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.m index f6a45fc..c96ddc2 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHCustomization/MHCustomization.m @@ -45,6 +45,7 @@ - (instancetype)init{ self.hideShare = NO; self.backButtonState = MHBackButtonStateWithBackArrow; self.videoProgressTintColor = UIColor.blackColor; + self.showMiniViews = NO; self.backgroundColorsForViewModes = [NSMutableDictionary dictionaryWithDictionary:@{@"0":UIColor.blackColor, @"1":UIColor.whiteColor, diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryController/MHGalleryController.h b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryController/MHGalleryController.h index 5b14d95..79ea7ad 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryController/MHGalleryController.h +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryController/MHGalleryController.h @@ -94,7 +94,7 @@ */ -(void)presentMHGalleryController:(MHGalleryController*)galleryController animated:(BOOL)animated - completion:(void (^)(void))completion; + completion:(void (^)(void))completion NS_SWIFT_NAME(presentGallery(gallery:animated:completion:)); /** * For dismissing MHGalleryController * @@ -106,4 +106,4 @@ dismissImageView:(UIImageView*)dismissImageView completion:(void (^)(void))completion; -@end \ No newline at end of file +@end diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryImageViewerViewController/MHGalleryImageViewerViewController.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryImageViewerViewController/MHGalleryImageViewerViewController.m index 0255882..5bb2adc 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryImageViewerViewController/MHGalleryImageViewerViewController.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGalleryImageViewerViewController/MHGalleryImageViewerViewController.m @@ -14,10 +14,14 @@ #import "Masonry.h" #import "MHGradientView.h" #import "MHBarButtonItem.h" +#import "MHMediaPreviewCollectionViewCell.h" @implementation MHPinchGestureRecognizer @end +@interface MHViewerPreviewCollectionCell : MHMediaPreviewCollectionViewCell +@end + @interface MHImageViewController () @property (nonatomic, strong) UIButton *moviewPlayerButtonBehinde; @property (nonatomic, strong) UIToolbar *moviePlayerToolBarTop; @@ -40,7 +44,7 @@ @interface MHImageViewController () @end -@interface MHGalleryImageViewerViewController() +@interface MHGalleryImageViewerViewController() @property (nonatomic, strong) MHGradientView *bottomSuperView; @property (nonatomic, strong) MHGradientView *topSuperView; @@ -48,6 +52,9 @@ @interface MHGalleryImageViewerViewController() indexPage ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse; + [self.pageViewController setViewControllers:@[imageViewController] direction:direction animated:YES completion:^(BOOL finished) { + weakSelf.pageIndex = imageViewController.pageIndex; + [weakSelf updateToolBarForItem:[weakSelf itemForIndex:weakSelf.pageIndex]]; + [weakSelf showCurrentIndex:weakSelf.pageIndex]; + [weakSelf.miniViewsCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:weakSelf.pageIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES]; + }]; +} + @end @@ -1519,6 +1615,8 @@ -(void)changeUIForViewMode:(MHGalleryViewMode)viewMode{ self.viewController.topSuperView.alpha = alpha; self.viewController.descriptionLabel.alpha = alpha; self.viewController.bottomSuperView.alpha = alpha; + + self.viewController.miniViewsCollectionView.alpha = alpha; if (!MHShouldShowStatusBar()) { alpha = 0; @@ -1675,5 +1773,27 @@ -(void)scrollViewDidZoom:(UIScrollView *)scrollView{ -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ } + @end +@implementation MHViewerPreviewCollectionCell + +- (instancetype)initWithFrame:(CGRect)frame{ + if (self = [super initWithFrame:frame]) { + self.tintColor = [UIColor whiteColor]; + } + return self; +} + +- (void)setTintColor:(UIColor *)tintColor{ + UIColor *color = tintColor ?: [UIColor whiteColor]; + [super setTintColor:color]; +} + +- (void)setSelected:(BOOL)selected{ + [super setSelected:selected]; + self.layer.borderWidth = 2.0; + self.layer.borderColor = selected ? self.tintColor.CGColor : [UIColor clearColor].CGColor; +} + +@end \ No newline at end of file diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGallerySharedManager/MHGallerySharedManager.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGallerySharedManager/MHGallerySharedManager.m index 503c0f4..402fb58 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGallerySharedManager/MHGallerySharedManager.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHGallerySharedManager/MHGallerySharedManager.m @@ -106,10 +106,11 @@ -(void)createThumbURL:(NSString*)urlString UIImage *image = [UIImage imageWithCGImage:im]; if (image != nil) { [SDImageCache.sharedImageCache storeImage:image - forKey:urlString]; - dispatch_async(dispatch_get_main_queue(), ^(void){ - succeedBlock(image,videoDurationTimeInSeconds,nil); - }); + forKey:urlString + completion:^{ + succeedBlock(image,videoDurationTimeInSeconds,nil); + }]; + } } }; @@ -312,17 +313,20 @@ -(void)getYoutubeThumbImage:(NSString*)URL }else if (self.youtubeThumbQuality == MHYoutubeThumbQualitySQ){ thumbURL = jsonData[@"data"][@"thumbnail"][@"sqDefault"]; } - [SDWebImageManager.sharedManager downloadImageWithURL:[NSURL URLWithString:thumbURL] - options:SDWebImageContinueInBackground - progress:nil - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - - [SDImageCache.sharedImageCache removeImageForKey:thumbURL]; - [SDImageCache.sharedImageCache storeImage:image - forKey:URL]; - - succeedBlock(image,[jsonData[@"data"][@"duration"] integerValue],nil); - }]; + + [SDWebImageManager.sharedManager loadImageWithURL:[NSURL URLWithString:thumbURL] + options:SDWebImageContinueInBackground + progress:nil + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + [SDImageCache.sharedImageCache removeImageForKey:thumbURL withCompletion:nil]; + + [SDImageCache.sharedImageCache storeImage:image + forKey:URL + completion: ^{ + succeedBlock(image,[jsonData[@"data"][@"duration"] integerValue],nil); + } + ]; + }]; } }); }else{ @@ -373,17 +377,18 @@ -(void)getVimdeoThumbImage:(NSString*)URL NSMutableDictionary *dictToSave = [self durationDict]; dictToSave[vimdeoURLString] = @([jsonData[0][@"duration"] integerValue]); [self setObjectToUserDefaults:dictToSave]; - - [SDWebImageManager.sharedManager downloadImageWithURL:[NSURL URLWithString:jsonData[0][quality]] - options:SDWebImageContinueInBackground - progress:nil - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - [SDImageCache.sharedImageCache removeImageForKey:jsonData[0][quality]]; - [SDImageCache.sharedImageCache storeImage:image - forKey:vimdeoURLString]; - - succeedBlock(image,[jsonData[0][@"duration"] integerValue],nil); - }]; + [SDWebImageManager.sharedManager loadImageWithURL:[NSURL URLWithString:jsonData[0][quality]] + options:SDWebImageContinueInBackground + progress:nil + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + [SDImageCache.sharedImageCache removeImageForKey:jsonData[0][quality] withCompletion:nil]; + + [SDImageCache.sharedImageCache storeImage:image + forKey:vimdeoURLString + completion:^{ + succeedBlock(image,[jsonData[0][@"duration"] integerValue],nil); + }]; + }]; }else{ succeedBlock(nil,0,nil); } diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHOverviewController/MHOverviewController.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHOverviewController/MHOverviewController.m index d99c165..fc983f3 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHOverviewController/MHOverviewController.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHOverviewController/MHOverviewController.m @@ -289,14 +289,14 @@ - (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL) -(void)getImageForItem:(MHGalleryItem*)item finishCallback:(void(^)(UIImage *image))FinishBlock{ - - [SDWebImageManager.sharedManager downloadImageWithURL:[NSURL URLWithString:item.URLString] - options:SDWebImageContinueInBackground - progress:nil - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - FinishBlock(image); - }]; + [SDWebImageManager.sharedManager loadImageWithURL:[NSURL URLWithString:item.URLString] + options:SDWebImageContinueInBackground + progress:nil + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + FinishBlock(image); + }]; } + -(void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHShareViewController/MHShareViewController.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHShareViewController/MHShareViewController.m index 69d18cc..f06562d 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHShareViewController/MHShareViewController.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/MHShareViewController/MHShareViewController.m @@ -876,13 +876,14 @@ -(void)getAllImagesForSelectedRows:(void(^)(NSArray *images))SuccessBlock }else if (item.image) { [self addDataToDownloadArray:item.image]; }else{ - - [SDWebImageManager.sharedManager downloadImageWithURL:[NSURL URLWithString:item.URLString] options:SDWebImageContinueInBackground progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - - MHImageURL *imageURLMH = [MHImageURL.alloc initWithURL:item.URLString - image:image]; - [weakSelf addDataToDownloadArray:imageURLMH]; - }]; + [SDWebImageManager.sharedManager loadImageWithURL:[NSURL URLWithString:item.URLString] + options:SDWebImageContinueInBackground + progress:nil + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + MHImageURL *imageURLMH = [MHImageURL.alloc initWithURL:item.URLString + image:image]; + [weakSelf addDataToDownloadArray:imageURLMH]; + }]; } } } @@ -962,25 +963,33 @@ -(void)showShareSheet{ } -(void)saveImages:(NSArray*)object{ [self getAllImagesForSelectedRows:^(NSArray *images) { - for (MHImageURL *dataURL in images) { + for (id dataObj in images) { + + if (![dataObj isKindOfClass:[MHImageURL class]] && + ![dataObj isKindOfClass:[UIImage class]]) { + continue; + } + + ALAssetsLibrary* library = ALAssetsLibrary.new; + NSData *data; - if ([dataURL.image isKindOfClass:[UIImage class]]) { - - UIImage *imageToStore = dataURL.image; - - ALAssetsLibrary* library = ALAssetsLibrary.new; - NSData *data; + if ([dataObj isKindOfClass:[MHImageURL class]] && + [[dataObj image] isKindOfClass:[UIImage class]]) { + UIImage *imageToStore = [dataObj image]; + if (imageToStore.images) { - data = [NSData dataWithContentsOfFile:[[SDImageCache sharedImageCache] defaultCachePathForKey:dataURL.URL]]; + data = [NSData dataWithContentsOfFile:[[SDImageCache sharedImageCache] defaultCachePathForKey:[dataObj URL]]]; }else{ data = UIImageJPEGRepresentation(imageToStore, 1.0); } - - [library writeImageDataToSavedPhotosAlbum:data metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) { - NSLog(@"%@",error); - }]; + } else if ([dataObj isKindOfClass:[UIImage class]]) { + data = UIImageJPEGRepresentation(dataObj, 1.0); } + + [library writeImageDataToSavedPhotosAlbum:data metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) { + NSLog(@"%@",error); + }]; } [self cancelPressed]; } saveDataToCameraRoll:YES]; diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.h b/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.h index 5b91909..cd6c6ff 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.h +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.h @@ -19,5 +19,5 @@ @property (nonatomic,assign) BOOL interactive; @property (nonatomic,assign) BOOL finishButtonAction; -@property (nonatomic,assign) id context; -@end \ No newline at end of file +@property (nonatomic,weak) id context; +@end diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.m index ed0adfd..13f15cf 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/Transitions/MHTransitionDismissMHGallery.m @@ -26,6 +26,18 @@ @interface MHTransitionDismissMHGallery() @property (nonatomic,strong) MHUIImageViewContentViewAnimation *cellImageSnapshot; @end +CGRect MakeRectWithAspectRatioInsideRect(CGSize size, CGRect rect) { + CGRect resultRect = AVMakeRectWithAspectRatioInsideRect(size, rect); + + if (isnan(resultRect.origin.x) || + isnan(resultRect.origin.y) || + isnan(resultRect.size.width) || + isnan(resultRect.size.height)) { + return rect; + } + return resultRect; +} + @implementation MHTransitionDismissMHGallery - (void)animateTransition:(id)transitionContext { @@ -55,7 +67,7 @@ - (void)animateTransition:(id)transitionCo MHUIImageViewContentViewAnimation *cellImageSnapshot = [MHUIImageViewContentViewAnimation.alloc initWithFrame:fromViewController.view.bounds]; cellImageSnapshot.image = image; - [cellImageSnapshot setFrame:AVMakeRectWithAspectRatioInsideRect(cellImageSnapshot.imageMH.size,fromViewController.view.bounds)]; + [cellImageSnapshot setFrame:MakeRectWithAspectRatioInsideRect(cellImageSnapshot.imageMH.size,fromViewController.view.bounds)]; cellImageSnapshot.contentMode = UIViewContentModeScaleAspectFit; [imageViewer.pageViewController.view setHidden:YES]; @@ -81,7 +93,7 @@ - (void)animateTransition:(id)transitionCo self.toTransform = self.startTransform; } if (self.toTransform != self.orientationTransformBeforeDismiss) { - cellImageSnapshot.frame = AVMakeRectWithAspectRatioInsideRect(cellImageSnapshot.imageMH.size,CGRectMake(0, 0, fromViewController.view.bounds.size.width, fromViewController.view.bounds.size.height)); + cellImageSnapshot.frame = MakeRectWithAspectRatioInsideRect(cellImageSnapshot.imageMH.size,CGRectMake(0, 0, fromViewController.view.bounds.size.width, fromViewController.view.bounds.size.height)); cellImageSnapshot.transform = CGAffineTransformMakeRotation(self.orientationTransformBeforeDismiss); cellImageSnapshot.center = [UIApplication sharedApplication].keyWindow.center; self.startFrame = cellImageSnapshot.bounds; @@ -153,7 +165,7 @@ -(void)startInteractiveTransition:(id)tran } self.cellImageSnapshot.image = image; - [self.cellImageSnapshot setFrame:AVMakeRectWithAspectRatioInsideRect(image.size,fromViewController.view.bounds)]; + [self.cellImageSnapshot setFrame:MakeRectWithAspectRatioInsideRect(image.size,fromViewController.view.bounds)]; self.startFrame = self.cellImageSnapshot.frame; self.startCenter = self.cellImageSnapshot.center; @@ -186,7 +198,7 @@ -(void)startInteractiveTransition:(id)tran if (imageViewerCurrent.isPlayingVideo && imageViewerCurrent.moviePlayer) { self.moviePlayer = imageViewerCurrent.moviePlayer; - [self.moviePlayer.view setFrame:AVMakeRectWithAspectRatioInsideRect(imageViewerCurrent.moviePlayer.naturalSize,fromViewController.view.bounds)]; + [self.moviePlayer.view setFrame:MakeRectWithAspectRatioInsideRect(imageViewerCurrent.moviePlayer.naturalSize,fromViewController.view.bounds)]; self.startFrame = self.moviePlayer.view.frame; @@ -199,13 +211,13 @@ -(void)startInteractiveTransition:(id)tran self.navFrame = fromViewController.navigationBar.frame; if (self.toTransform != self.orientationTransformBeforeDismiss && !self.wrongTransform) { if (self.moviePlayer) { - [self.moviePlayer.view setFrame:AVMakeRectWithAspectRatioInsideRect(imageViewerCurrent.moviePlayer.naturalSize,CGRectMake(0, 0, fromViewController.view.bounds.size.width, fromViewController.view.bounds.size.height))]; + [self.moviePlayer.view setFrame:MakeRectWithAspectRatioInsideRect(imageViewerCurrent.moviePlayer.naturalSize,CGRectMake(0, 0, fromViewController.view.bounds.size.width, fromViewController.view.bounds.size.height))]; self.moviePlayer.view.transform = CGAffineTransformMakeRotation(self.orientationTransformBeforeDismiss); self.moviePlayer.view.center = UIApplication.sharedApplication.keyWindow.center; self.startFrame = self.moviePlayer.view.bounds; self.startCenter = self.moviePlayer.view.center; }else{ - [self.cellImageSnapshot setFrame:AVMakeRectWithAspectRatioInsideRect(image.size,CGRectMake(0, 0, fromViewController.view.bounds.size.width, fromViewController.view.bounds.size.height))]; + [self.cellImageSnapshot setFrame:MakeRectWithAspectRatioInsideRect(image.size,CGRectMake(0, 0, fromViewController.view.bounds.size.width, fromViewController.view.bounds.size.height))]; self.cellImageSnapshot.transform = CGAffineTransformMakeRotation(self.orientationTransformBeforeDismiss); self.cellImageSnapshot.center = UIApplication.sharedApplication.keyWindow.center; self.startFrame = self.cellImageSnapshot.bounds; @@ -256,11 +268,10 @@ -(void)finishInteractiveTransition{ delayTime =0.2; } double delayInSeconds = delayTime; + typeof(self.context) context = self.context; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ - - if (self.transitionImageView.contentMode == UIViewContentModeScaleAspectFill) { [self.cellImageSnapshot animateToViewMode:UIViewContentModeScaleAspectFill forFrame:[self.containerView convertRect:self.transitionImageView.frame @@ -306,7 +317,7 @@ -(void)finishInteractiveTransition{ self.transitionImageView.hidden = NO; [self.cellImageSnapshot removeFromSuperview]; [self.backView removeFromSuperview]; - [self.context completeTransition:!self.context.transitionWasCancelled]; + [context completeTransition:!context.transitionWasCancelled]; self.context = nil; }]; }); @@ -316,6 +327,8 @@ -(void)finishInteractiveTransition{ -(void)cancelInteractiveTransition{ [super cancelInteractiveTransition]; + + typeof(self.context) context = self.context; [UIView animateWithDuration:0.3 animations:^{ if (self.moviePlayer) { @@ -338,7 +351,7 @@ -(void)cancelInteractiveTransition{ [self.cellImageSnapshot removeFromSuperview]; [self.backView removeFromSuperview]; - UINavigationController *fromViewController = (UINavigationController*)[self.context viewControllerForKey:UITransitionContextFromViewControllerKey]; + UINavigationController *fromViewController = (UINavigationController*)[context viewControllerForKey:UITransitionContextFromViewControllerKey]; if (self.moviePlayer) { if (self.toTransform != self.orientationTransformBeforeDismiss) { self.moviePlayer.view.transform = CGAffineTransformMakeRotation(self.toTransform); @@ -358,12 +371,12 @@ -(void)cancelInteractiveTransition{ [imageViewController.view insertSubview:self.moviePlayer.view atIndex:2]; } - if ([self.context respondsToSelector:@selector(viewForKey:)]) { // is on iOS 8? + if ([context respondsToSelector:@selector(viewForKey:)]) { // is on iOS 8? [UIApplication.sharedApplication.keyWindow addSubview:fromViewController.view]; self.moviePlayer = nil; } - [self.context completeTransition:NO]; + [context completeTransition:NO]; if (self.moviePlayer) { [UIView performWithoutAnimation:^{ [self doOrientationwithFromViewController:fromViewController]; diff --git a/MHVideoPhotoGallery/MMHVideoPhotoGallery/UIImageView+MHGallery/UIImageView+MHGallery.m b/MHVideoPhotoGallery/MMHVideoPhotoGallery/UIImageView+MHGallery/UIImageView+MHGallery.m index f0ac984..46955ff 100644 --- a/MHVideoPhotoGallery/MMHVideoPhotoGallery/UIImageView+MHGallery/UIImageView+MHGallery.m +++ b/MHVideoPhotoGallery/MMHVideoPhotoGallery/UIImageView+MHGallery/UIImageView+MHGallery.m @@ -21,7 +21,7 @@ -(void)setThumbWithURL:(NSString*)URL successBlock:^(UIImage *image, NSUInteger videoDuration, NSError *error) { if (!weakSelf) return; - dispatch_main_sync_safe(^{ + dispatch_main_async_safe(^{ if (!weakSelf) return; if (image){ weakSelf.image = image; @@ -80,7 +80,7 @@ -(void)setImageForImageView:(UIImage*)image __weak typeof(self) weakSelf = self; if (!weakSelf) return; - dispatch_main_sync_safe(^{ + dispatch_main_async_safe(^{ weakSelf.image = image; [weakSelf setNeedsLayout]; if (succeedBlock) { diff --git a/MHVideoPhotoGallery/Storyboard.storyboard b/MHVideoPhotoGallery/Storyboard.storyboard index f2d68fe..75c42b7 100644 --- a/MHVideoPhotoGallery/Storyboard.storyboard +++ b/MHVideoPhotoGallery/Storyboard.storyboard @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -14,8 +18,7 @@ - - + @@ -34,8 +37,8 @@ + - @@ -50,8 +53,8 @@ + - @@ -70,10 +73,9 @@ - + - - + @@ -87,8 +89,8 @@ + - @@ -107,36 +109,33 @@ - + - - - + + - + - + - + - - @@ -149,8 +148,7 @@ - - + @@ -176,31 +174,28 @@ - + - - - - + + + - + - + - - - - + + + - - - - + + + @@ -211,34 +206,29 @@ - - - @@ -261,8 +251,7 @@ - - + @@ -275,8 +264,7 @@ - - + @@ -299,8 +287,8 @@ + - @@ -319,36 +307,33 @@ - + - - - + + - + - + - + - - @@ -361,8 +346,7 @@ - - + @@ -385,8 +369,8 @@ + - @@ -405,10 +389,9 @@ - + - - + @@ -422,8 +405,8 @@ + - @@ -442,20 +425,18 @@ - + - - + - - + @@ -479,4 +460,9 @@ + + + + + diff --git a/MHVideoPhotoGallery/en.lproj/InfoPlist.strings b/MHVideoPhotoGallery/en.lproj/InfoPlist.strings index 477b28f..6331345 100644 --- a/MHVideoPhotoGallery/en.lproj/InfoPlist.strings +++ b/MHVideoPhotoGallery/en.lproj/InfoPlist.strings @@ -1,2 +1,4 @@ -/* Localized versions of Info.plist keys */ - +{ + "NSPhotoLibraryUsageDescription" = "Photos usage description"; + "NSCameraUsageDescription" = "Camera usage description"; +} \ No newline at end of file diff --git a/Podfile b/Podfile index 5612382..db0addc 100644 --- a/Podfile +++ b/Podfile @@ -4,6 +4,8 @@ platform :ios, "7.0" inhibit_all_warnings! -pod 'SDWebImage' -pod 'TTTAttributedLabel', '1.13.3' -pod 'Masonry' \ No newline at end of file +target 'MHVideoPhotoGallery' do + pod 'SDWebImage' + pod 'TTTAttributedLabel', '1.13.3' + pod 'Masonry' +end \ No newline at end of file diff --git a/Podfile.lock b/Podfile.lock index cb03a92..8b3e869 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,8 +1,8 @@ PODS: - - Masonry (0.6.3) - - SDWebImage (3.7.3): - - SDWebImage/Core (= 3.7.3) - - SDWebImage/Core (3.7.3) + - Masonry (1.0.2) + - SDWebImage (4.0.0): + - SDWebImage/Core (= 4.0.0) + - SDWebImage/Core (4.0.0) - TTTAttributedLabel (1.13.3) DEPENDENCIES: @@ -11,8 +11,10 @@ DEPENDENCIES: - TTTAttributedLabel (= 1.13.3) SPEC CHECKSUMS: - Masonry: ff105a956abcd19a618b2028b121cb638d7a8e2f - SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84 + Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e + SDWebImage: 76a6348bdc74eb5a55dd08a091ef298e56b55e41 TTTAttributedLabel: 6f3174aef8e738f44dff97c2eb7d8184f6ab6277 -COCOAPODS: 0.39.0 +PODFILE CHECKSUM: abfb88065a2a66ef37aa56af4e124e6ce25dfcac + +COCOAPODS: 1.3.1