├── .swift-version ├── DMLPhotoBrowser ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── DMLProgressShapeLayer.h │ ├── DMLPhotoCell.h │ ├── DMLPhotoScrollView.h │ ├── DMLPhotoBrowser.h │ ├── DMLPhotoItem.h │ ├── DMLPhotoItem.m │ ├── DMLProgressShapeLayer.m │ └── DMLPhotoCell.m ├── _Pods.xcodeproj ├── photo.gif ├── Example ├── Tests │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Tests-Prefix.pch │ ├── Tests-Info.plist │ └── Tests.m ├── Pods │ ├── Headers │ │ ├── Private │ │ │ ├── SDWebImage │ │ │ │ ├── UIImage+GIF.h │ │ │ │ ├── SDImageCache.h │ │ │ │ ├── NSImage+WebCache.h │ │ │ │ ├── SDWebImageCompat.h │ │ │ │ ├── UIView+WebCache.h │ │ │ │ ├── SDImageCacheConfig.h │ │ │ │ ├── SDWebImageDecoder.h │ │ │ │ ├── SDWebImageManager.h │ │ │ │ ├── SDWebImageOperation.h │ │ │ │ ├── UIButton+WebCache.h │ │ │ │ ├── UIImage+MultiFormat.h │ │ │ │ ├── SDWebImageDownloader.h │ │ │ │ ├── SDWebImagePrefetcher.h │ │ │ │ ├── UIImageView+WebCache.h │ │ │ │ ├── NSData+ImageContentType.h │ │ │ │ ├── UIView+WebCacheOperation.h │ │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ │ └── UIImageView+HighlightedWebCache.h │ │ │ ├── DMLPhotoBrowser │ │ │ │ ├── DMLPhotoCell.h │ │ │ │ ├── DMLPhotoItem.h │ │ │ │ ├── DMLPhotoBrowser.h │ │ │ │ ├── DMLPhotoScrollView.h │ │ │ │ └── DMLProgressShapeLayer.h │ │ │ └── FLAnimatedImage │ │ │ │ ├── FLAnimatedImage.h │ │ │ │ └── FLAnimatedImageView.h │ │ └── Public │ │ │ ├── SDWebImage │ │ │ ├── SDImageCache.h │ │ │ ├── UIImage+GIF.h │ │ │ ├── NSImage+WebCache.h │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── SDWebImageManager.h │ │ │ ├── UIButton+WebCache.h │ │ │ ├── UIView+WebCache.h │ │ │ ├── SDImageCacheConfig.h │ │ │ ├── SDWebImageOperation.h │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── UIImageView+WebCache.h │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── UIView+WebCacheOperation.h │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ └── UIImageView+HighlightedWebCache.h │ │ │ ├── DMLPhotoBrowser │ │ │ ├── DMLPhotoCell.h │ │ │ ├── DMLPhotoItem.h │ │ │ ├── DMLPhotoBrowser.h │ │ │ ├── DMLPhotoScrollView.h │ │ │ └── DMLProgressShapeLayer.h │ │ │ └── FLAnimatedImage │ │ │ ├── FLAnimatedImage.h │ │ │ └── FLAnimatedImageView.h │ ├── Target Support Files │ │ ├── SDWebImage │ │ │ ├── SDWebImage.modulemap │ │ │ ├── SDWebImage-dummy.m │ │ │ ├── SDWebImage-prefix.pch │ │ │ ├── SDWebImage.xcconfig │ │ │ ├── Info.plist │ │ │ └── SDWebImage-umbrella.h │ │ ├── DMLPhotoBrowser │ │ │ ├── DMLPhotoBrowser-dummy.m │ │ │ ├── DMLPhotoBrowser-prefix.pch │ │ │ └── DMLPhotoBrowser.xcconfig │ │ ├── FLAnimatedImage │ │ │ ├── FLAnimatedImage-dummy.m │ │ │ ├── FLAnimatedImage-prefix.pch │ │ │ └── FLAnimatedImage.xcconfig │ │ └── Pods-DMLPhotoBrowser_Example │ │ │ ├── Pods-DMLPhotoBrowser_Example.modulemap │ │ │ ├── Pods-DMLPhotoBrowser_Example-dummy.m │ │ │ ├── Pods-DMLPhotoBrowser_Example-umbrella.h │ │ │ ├── Info.plist │ │ │ ├── Pods-DMLPhotoBrowser_Example.debug.xcconfig │ │ │ ├── Pods-DMLPhotoBrowser_Example.release.xcconfig │ │ │ ├── Pods-DMLPhotoBrowser_Example-acknowledgements.markdown │ │ │ ├── Pods-DMLPhotoBrowser_Example-frameworks.sh │ │ │ ├── Pods-DMLPhotoBrowser_Example-acknowledgements.plist │ │ │ └── Pods-DMLPhotoBrowser_Example-resources.sh │ ├── SDWebImage │ │ ├── SDWebImage │ │ │ ├── SDWebImageOperation.h │ │ │ ├── NSImage+WebCache.h │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── UIImage+GIF.h │ │ │ ├── NSImage+WebCache.m │ │ │ ├── SDImageCacheConfig.m │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── UIView+WebCacheOperation.h │ │ │ ├── SDImageCacheConfig.h │ │ │ ├── NSData+ImageContentType.m │ │ │ ├── UIImage+GIF.m │ │ │ ├── UIImageView+HighlightedWebCache.m │ │ │ ├── UIView+WebCacheOperation.m │ │ │ ├── SDWebImageCompat.m │ │ │ ├── UIView+WebCache.h │ │ │ ├── SDWebImageCompat.h │ │ │ ├── UIImageView+HighlightedWebCache.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImagePrefetcher.m │ │ │ ├── UIImage+MultiFormat.m │ │ │ └── UIImageView+WebCache.m │ │ └── LICENSE │ ├── Manifest.lock │ ├── DMLPhotoBrowser │ │ ├── DMLPhotoBrowser │ │ │ └── Classes │ │ │ │ ├── DMLProgressShapeLayer.h │ │ │ │ ├── DMLPhotoCell.h │ │ │ │ ├── DMLPhotoScrollView.h │ │ │ │ ├── DMLPhotoBrowser.h │ │ │ │ ├── DMLPhotoItem.h │ │ │ │ ├── DMLPhotoItem.m │ │ │ │ ├── DMLProgressShapeLayer.m │ │ │ │ └── DMLPhotoCell.m │ │ ├── README.md │ │ └── LICENSE │ ├── Local Podspecs │ │ └── DMLPhotoBrowser.podspec.json │ ├── M80AttributedLabel │ │ ├── M80AttributedLabel │ │ │ ├── NSMutableAttributedString+M80.h │ │ │ ├── M80AttributedLabelURL.h │ │ │ ├── M80AttributedLabelDefines.h │ │ │ ├── M80AttributedLabelAttachment.h │ │ │ ├── NSMutableAttributedString+M80.m │ │ │ ├── M80AttributedLabel.h │ │ │ ├── M80AttributedLabelURL.m │ │ │ └── M80AttributedLabelAttachment.m │ │ ├── LICENSE │ │ └── README.md │ ├── NIMKit │ │ ├── LICENSE │ │ └── README.md │ └── FLAnimatedImage │ │ ├── LICENSE │ │ ├── FLAnimatedImage │ │ ├── FLAnimatedImageView.h │ │ └── FLAnimatedImage.h │ │ └── README.md ├── DMLPhotoBrowser │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Images.xcassets │ │ ├── Images │ │ │ ├── Contents.json │ │ │ ├── 1.imageset │ │ │ │ ├── 1.jpg │ │ │ │ └── Contents.json │ │ │ ├── 2.imageset │ │ │ │ ├── 2.jpg │ │ │ │ └── Contents.json │ │ │ ├── 3.imageset │ │ │ │ ├── 3.jpg │ │ │ │ └── Contents.json │ │ │ ├── 4.imageset │ │ │ │ ├── 4.jpg │ │ │ │ └── Contents.json │ │ │ ├── 5.imageset │ │ │ │ ├── 5.jpg │ │ │ │ └── Contents.json │ │ │ ├── 6.imageset │ │ │ │ ├── 6.jpg │ │ │ │ └── Contents.json │ │ │ ├── 7.imageset │ │ │ │ ├── 7.jpg │ │ │ │ └── Contents.json │ │ │ ├── 8.imageset │ │ │ │ ├── 8.jpg │ │ │ │ └── Contents.json │ │ │ └── 9.imageset │ │ │ │ ├── 9.jpg │ │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── DMLViewController.h │ ├── Classes │ │ ├── NetShowViewController.h │ │ ├── LocalShowViewController.h │ │ ├── OnlyOriginalViewController.h │ │ └── LocalShowViewController.m │ ├── DMLAppDelegate.h │ ├── main.m │ ├── DMLPhotoBrowser-Prefix.pch │ ├── DMLViewController.m │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── DMLPhotoBrowser-Info.plist │ ├── DMLAppDelegate.m │ └── Category │ │ └── FLAnimatedImageView+SD_WebCache.m ├── DMLPhotoBrowser.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── DMLPhotoBrowser-Example.xcscheme ├── Podfile ├── DMLPhotoBrowser.xcworkspace │ └── contents.xcworkspacedata └── Podfile.lock ├── .travis.yml ├── .gitignore ├── LICENSE ├── DMLPhotoBrowser.podspec └── README.md /.swift-version: -------------------------------------------------------------------------------- 1 | 2.3 2 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /photo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/photo.gif -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSImage+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSImage+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCacheConfig.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCacheConfig.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/DMLPhotoBrowser/DMLPhotoCell.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoCell.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/DMLPhotoBrowser/DMLPhotoItem.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoItem.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/FLAnimatedImage/FLAnimatedImage.h: -------------------------------------------------------------------------------- 1 | ../../../FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/DMLPhotoBrowser/DMLPhotoCell.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoCell.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/DMLPhotoBrowser/DMLPhotoItem.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoItem.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/FLAnimatedImage/FLAnimatedImage.h: -------------------------------------------------------------------------------- 1 | ../../../FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/DMLPhotoBrowser/DMLPhotoBrowser.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoBrowser.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/FLAnimatedImage/FLAnimatedImageView.h: -------------------------------------------------------------------------------- 1 | ../../../FLAnimatedImage/FLAnimatedImage/FLAnimatedImageView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/DMLPhotoBrowser/DMLPhotoBrowser.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoBrowser.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/FLAnimatedImage/FLAnimatedImageView.h: -------------------------------------------------------------------------------- 1 | ../../../FLAnimatedImage/FLAnimatedImage/FLAnimatedImageView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/DMLPhotoBrowser/DMLPhotoScrollView.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoScrollView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/DMLPhotoBrowser/DMLPhotoScrollView.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoScrollView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/DMLPhotoBrowser/DMLProgressShapeLayer.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLProgressShapeLayer.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/DMLPhotoBrowser/DMLProgressShapeLayer.h: -------------------------------------------------------------------------------- 1 | ../../../DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLProgressShapeLayer.h -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/1.imageset/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/1.imageset/1.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/2.imageset/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/2.imageset/2.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/3.imageset/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/3.imageset/3.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/4.imageset/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/4.imageset/4.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/5.imageset/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/5.imageset/5.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/6.imageset/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/6.imageset/6.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/7.imageset/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/7.imageset/7.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/8.imageset/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/8.imageset/8.jpg -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/9.imageset/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrDML/DMLPhotoBrowser/HEAD/Example/DMLPhotoBrowser/Images.xcassets/Images/9.imageset/9.jpg -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DMLPhotoBrowser/DMLPhotoBrowser-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_DMLPhotoBrowser : NSObject 3 | @end 4 | @implementation PodsDummy_DMLPhotoBrowser 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/FLAnimatedImage/FLAnimatedImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_FLAnimatedImage : NSObject 3 | @end 4 | @implementation PodsDummy_FLAnimatedImage 5 | @end 6 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_DMLPhotoBrowser_Example { 2 | umbrella header "Pods-DMLPhotoBrowser_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_DMLPhotoBrowser_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_DMLPhotoBrowser_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/DMLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLViewController.h 3 | // DMLPhotoBrowser 4 | // 5 | // Created by MrDML on 01/03/2018. 6 | // Copyright (c) 2018 MrDML. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface DMLViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '8.0' 3 | 4 | target 'DMLPhotoBrowser_Example' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | pod 'DMLPhotoBrowser', '~> 0.1.6' 8 | end 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DMLPhotoBrowser/DMLPhotoBrowser-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/FLAnimatedImage/FLAnimatedImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Classes/NetShowViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NetShowViewController.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NetShowViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Classes/LocalShowViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LocalShowViewController.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LocalShowViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Classes/OnlyOriginalViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // OnlyOriginalViewController.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2018/1/2. 6 | // Copyright © 2018年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface OnlyOriginalViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/DMLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLAppDelegate.h 3 | // DMLPhotoBrowser 4 | // 5 | // Created by MrDML on 01/03/2018. 6 | // Copyright (c) 2018 MrDML. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface DMLAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DMLPhotoBrowser 4 | // 5 | // Created by MrDML on 01/03/2018. 6 | // Copyright (c) 2018 MrDML. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "DMLAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([DMLAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/DMLPhotoBrowser-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/Images/9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "9.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_DMLPhotoBrowser_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_DMLPhotoBrowser_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | @interface NSImage (WebCache) 16 | 17 | - (CGImageRef)CGImage; 18 | - (NSArray *)images; 19 | - (BOOL)isGIF; 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/DMLPhotoBrowser.xcworkspace -scheme DMLPhotoBrowser-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DMLPhotoBrowser (0.1.6): 3 | - FLAnimatedImage (~> 1.0.12) 4 | - SDWebImage (~> 4.1.0) 5 | - FLAnimatedImage (1.0.12) 6 | - SDWebImage (4.1.2): 7 | - SDWebImage/Core (= 4.1.2) 8 | - SDWebImage/Core (4.1.2) 9 | 10 | DEPENDENCIES: 11 | - DMLPhotoBrowser (~> 0.1.6) 12 | 13 | SPEC CHECKSUMS: 14 | DMLPhotoBrowser: 3268fb35df59755011aa7587999caefd69544738 15 | FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31 16 | SDWebImage: cb6f9f266a9977741efcbc21e618e8be3734c774 17 | 18 | PODFILE CHECKSUM: 53b015c782af48069f245e56c9fde148146528f6 19 | 20 | COCOAPODS: 1.3.1 21 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DMLPhotoBrowser (0.1.6): 3 | - FLAnimatedImage (~> 1.0.12) 4 | - SDWebImage (~> 4.1.0) 5 | - FLAnimatedImage (1.0.12) 6 | - SDWebImage (4.1.2): 7 | - SDWebImage/Core (= 4.1.2) 8 | - SDWebImage/Core (4.1.2) 9 | 10 | DEPENDENCIES: 11 | - DMLPhotoBrowser (~> 0.1.6) 12 | 13 | SPEC CHECKSUMS: 14 | DMLPhotoBrowser: 3268fb35df59755011aa7587999caefd69544738 15 | FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31 16 | SDWebImage: cb6f9f266a9977741efcbc21e618e8be3734c774 17 | 18 | PODFILE CHECKSUM: 53b015c782af48069f245e56c9fde148146528f6 19 | 20 | COCOAPODS: 1.3.1 21 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "NSData+ImageContentType.h" 11 | 12 | @interface UIImage (MultiFormat) 13 | 14 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 15 | - (nullable NSData *)sd_imageData; 16 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) james 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | @interface UIImage (ForceDecode) 14 | 15 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; 16 | 17 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLProgressShapeLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLProgressShapeLayer.h 3 | // DMLPhotoBrowserExample 4 | // 5 | // Created by 戴明亮 on 2017/12/21. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DMLProgressShapeLayer : CAShapeLayer 13 | 14 | 15 | /** 16 | 实例方法 17 | 18 | @param frame <#frame description#> 19 | @return <#return value description#> 20 | */ 21 | - (instancetype)initWithFrame:(CGRect)frame; 22 | /** 23 | 开始动画 24 | */ 25 | - (void)startProgressAnimation; 26 | /** 27 | 停止动画 28 | */ 29 | - (void)stopProgressAnimation; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLProgressShapeLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLProgressShapeLayer.h 3 | // DMLPhotoBrowserExample 4 | // 5 | // Created by 戴明亮 on 2017/12/21. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DMLProgressShapeLayer : CAShapeLayer 13 | 14 | 15 | /** 16 | 实例方法 17 | 18 | @param frame <#frame description#> 19 | @return <#return value description#> 20 | */ 21 | - (instancetype)initWithFrame:(CGRect)frame; 22 | /** 23 | 开始动画 24 | */ 25 | - (void)startProgressAnimation; 26 | /** 27 | 停止动画 28 | */ 29 | - (void)stopProgressAnimation; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface UIImage (GIF) 13 | 14 | /** 15 | * Compatibility method - creates an animated UIImage from an NSData, it will only contain the 1st frame image 16 | */ 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 18 | 19 | /** 20 | * Checks if an UIImage instance is a GIF. Will use the `images` array 21 | */ 22 | - (BOOL)isGIF; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | # Pods/ 34 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = -framework "ImageIO" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoBrowserTests.m 3 | // DMLPhotoBrowserTests 4 | // 5 | // Created by MrDML on 01/03/2018. 6 | // Copyright (c) 2018 MrDML. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSImage+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSImage (WebCache) 14 | 15 | - (CGImageRef)CGImage { 16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; 18 | return cgImage; 19 | } 20 | 21 | - (NSArray *)images { 22 | return nil; 23 | } 24 | 25 | - (BOOL)isGIF { 26 | return NO; 27 | } 28 | 29 | @end 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/DMLPhotoBrowser.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DMLPhotoBrowser", 3 | "version": "0.1.4", 4 | "summary": "DMLPhotoBrowser.", 5 | "description": "The image browser supports both local and network.", 6 | "homepage": "https://github.com/MrDML/DMLPhotoBrowser", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "MrDML": "dml1630@163.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/MrDML/DMLPhotoBrowser.git", 16 | "tag": "0.1.4" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "DMLPhotoBrowser/Classes/**/*", 22 | "dependencies": { 23 | "FLAnimatedImage": [ 24 | "~> 1.0.12" 25 | ], 26 | "SDWebImage": [ 27 | "~> 4.1.0" 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCacheConfig.h" 10 | 11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week 12 | 13 | @implementation SDImageCacheConfig 14 | 15 | - (instancetype)init { 16 | if (self = [super init]) { 17 | _shouldDecompressImages = YES; 18 | _shouldDisableiCloud = YES; 19 | _shouldCacheImagesInMemory = YES; 20 | _maxCacheAge = kDefaultCacheMaxCacheAge; 21 | _maxCacheSize = 0; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/FLAnimatedImage/FLAnimatedImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FLAnimatedImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FLAnimatedImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "QuartzCore" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/FLAnimatedImage 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DMLPhotoBrowser/DMLPhotoBrowser.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/DMLPhotoBrowser 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/DMLPhotoBrowser" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FLAnimatedImage" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/DMLPhotoBrowser 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/DMLViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLViewController.m 3 | // DMLPhotoBrowser 4 | // 5 | // Created by MrDML on 01/03/2018. 6 | // Copyright (c) 2018 MrDML. All rights reserved. 7 | // 8 | 9 | #import "DMLViewController.h" 10 | #import "SDWebImageManager.h" 11 | 12 | @interface DMLViewController () 13 | 14 | @end 15 | 16 | @implementation DMLViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | } 23 | 24 | - (IBAction)clearPictureMemory:(UIButton *)sender { 25 | 26 | [[SDWebImageManager sharedManager].imageCache clearMemory]; 27 | [[SDWebImageManager sharedManager].imageCache clearDiskOnCompletion:nil]; 28 | } 29 | 30 | 31 | - (void)didReceiveMemoryWarning 32 | { 33 | [super didReceiveMemoryWarning]; 34 | // Dispose of any resources that can be recreated. 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | typedef NS_ENUM(NSInteger, SDImageFormat) { 14 | SDImageFormatUndefined = -1, 15 | SDImageFormatJPEG = 0, 16 | SDImageFormatPNG, 17 | SDImageFormatGIF, 18 | SDImageFormatTIFF, 19 | SDImageFormatWebP 20 | }; 21 | 22 | @interface NSData (ImageContentType) 23 | 24 | /** 25 | * Return image format 26 | * 27 | * @param data the input image data 28 | * 29 | * @return the image format as `SDImageFormat` (enum) 30 | */ 31 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLPhotoCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoCell.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DMLPhotoScrollView.h" 11 | #import "DMLPhotoItem.h" 12 | 13 | @interface DMLPhotoCell : UICollectionViewCell 14 | @property (nonatomic, strong) DMLPhotoItem *photoItem; 15 | + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath; 16 | 17 | /** 18 | 获取当前的缩放视图 19 | 20 | @param collectionView <#collectionView description#> 21 | @param page <#page description#> 22 | @return <#return value description#> 23 | */ 24 | + (DMLPhotoScrollView *)collectionView:(UICollectionView *)collectionView PhotoScrollViewforPage:(NSInteger)page; 25 | 26 | /** 27 | 是否隐藏进度视图 28 | 29 | @param hidden <#hidden description#> 30 | */ 31 | - (void)progressLayerisHidden:(BOOL)hidden; 32 | @end 33 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLPhotoScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoScrollView.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DMLPhotoItem.h" 12 | #import "DMLProgressShapeLayer.h" 13 | 14 | //@class FLAnimatedImageView; 15 | typedef void(^progressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * targetURL); 16 | typedef void(^completedBlock)(UIImage *image, NSURL *imageURL); 17 | 18 | @interface DMLPhotoScrollView : UIScrollView 19 | @property (nonatomic, strong)UIImageView *imageView; 20 | @property (nonatomic, strong)DMLPhotoItem *photoItem; 21 | @property (nonatomic, strong)DMLProgressShapeLayer *progressLayer; 22 | @property (nonatomic, copy) progressBlock progressBlock; 23 | @property (nonatomic, copy) completedBlock completedBolck; 24 | /** 25 | 取消当前加载的图片请求 26 | */ 27 | - (void)cancelCurrentImageLoad; 28 | @end 29 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLPhotoBrowser.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoBrowser.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | 指示器样式 13 | 14 | - kBrowserPagingStyleDot: 。。。 15 | - kBrowserPagingStyleText: 4/5 16 | */ 17 | typedef NS_ENUM(NSInteger, kBrowserPagingStyle){ 18 | kBrowserPagingStyleDot, 19 | kBrowserPagingStyleText 20 | }; 21 | 22 | @class DMLPhotoItem; 23 | 24 | @interface DMLPhotoBrowser : UIViewController 25 | 26 | /** 27 | pageStyle default:kBrowserPagingStyleDot 28 | */ 29 | @property (nonatomic, assign) kBrowserPagingStyle pageStyel; 30 | 31 | + (instancetype)browserWithPhotoItems:(NSArray *)photoItems selectedIndex:(NSUInteger)selectedIndex; 32 | - (instancetype)initWithPhotoItems:(NSArray *)photoItems selectedIndex:(NSUInteger)selectedIndex; 33 | - (void)showPhotoBrowser; 34 | @end 35 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/NSMutableAttributedString+M80.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableAttributedString+M80.h 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "M80AttributedLabelDefines.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSMutableAttributedString (M80) 14 | 15 | - (void)m80_setTextColor:(UIColor*)color; 16 | - (void)m80_setTextColor:(UIColor*)color range:(NSRange)range; 17 | 18 | - (void)m80_setFont:(UIFont*)font; 19 | - (void)m80_setFont:(UIFont*)font range:(NSRange)range; 20 | 21 | - (void)m80_setUnderlineStyle:(CTUnderlineStyle)style 22 | modifier:(CTUnderlineStyleModifiers)modifier; 23 | - (void)m80_setUnderlineStyle:(CTUnderlineStyle)style 24 | modifier:(CTUnderlineStyleModifiers)modifier 25 | range:(NSRange)range; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.1.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoCell.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DMLPhotoScrollView.h" 11 | #import "DMLPhotoItem.h" 12 | 13 | @interface DMLPhotoCell : UICollectionViewCell 14 | @property (nonatomic, strong) DMLPhotoItem *photoItem; 15 | + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath; 16 | 17 | /** 18 | 获取当前的缩放视图 19 | 20 | @param collectionView <#collectionView description#> 21 | @param page <#page description#> 22 | @return <#return value description#> 23 | */ 24 | + (DMLPhotoScrollView *)collectionView:(UICollectionView *)collectionView PhotoScrollViewforPage:(NSInteger)page; 25 | 26 | /** 27 | 是否隐藏进度视图 28 | 29 | @param hidden <#hidden description#> 30 | */ 31 | - (void)progressLayerisHidden:(BOOL)hidden; 32 | @end 33 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoScrollView.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DMLPhotoItem.h" 12 | #import "DMLProgressShapeLayer.h" 13 | 14 | //@class FLAnimatedImageView; 15 | typedef void(^progressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * targetURL); 16 | typedef void(^completedBlock)(UIImage *image, NSURL *imageURL); 17 | 18 | @interface DMLPhotoScrollView : UIScrollView 19 | @property (nonatomic, strong)UIImageView *imageView; 20 | @property (nonatomic, strong)DMLPhotoItem *photoItem; 21 | @property (nonatomic, strong)DMLProgressShapeLayer *progressLayer; 22 | @property (nonatomic, copy) progressBlock progressBlock; 23 | @property (nonatomic, copy) completedBlock completedBolck; 24 | /** 25 | 取消当前加载的图片请求 26 | */ 27 | - (void)cancelCurrentImageLoad; 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/M80AttributedLabelURL.h: -------------------------------------------------------------------------------- 1 | // 2 | // M80AttributedLabelURL.h 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "M80AttributedLabelDefines.h" 10 | 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface M80AttributedLabelURL : NSObject 15 | @property (nonatomic,strong) id linkData; 16 | @property (nonatomic,assign) NSRange range; 17 | @property (nonatomic,strong,nullable) UIColor *color; 18 | 19 | + (M80AttributedLabelURL *)urlWithLinkData:(id)linkData 20 | range:(NSRange)range 21 | color:(nullable UIColor *)color; 22 | 23 | 24 | + (nullable NSArray *)detectLinks:(nullable NSString *)plainText; 25 | 26 | + (void)setCustomDetectMethod:(nullable M80CustomDetectLinkBlock)block; 27 | @end 28 | 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoBrowser.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoBrowser.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | 指示器样式 13 | 14 | - kBrowserPagingStyleDot: 。。。 15 | - kBrowserPagingStyleText: 4/5 16 | */ 17 | typedef NS_ENUM(NSInteger, kBrowserPagingStyle){ 18 | kBrowserPagingStyleDot, 19 | kBrowserPagingStyleText 20 | }; 21 | 22 | @class DMLPhotoItem; 23 | 24 | @interface DMLPhotoBrowser : UIViewController 25 | 26 | /** 27 | pageStyle default:kBrowserPagingStyleDot 28 | */ 29 | @property (nonatomic, assign) kBrowserPagingStyle pageStyel; 30 | 31 | + (instancetype)browserWithPhotoItems:(NSArray *)photoItems selectedIndex:(NSUInteger)selectedIndex; 32 | - (instancetype)initWithPhotoItems:(NSArray *)photoItems selectedIndex:(NSUInteger)selectedIndex; 33 | - (void)showPhotoBrowser; 34 | @end 35 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "NSData+ImageContentType.h" 14 | #import "NSImage+WebCache.h" 15 | #import "SDImageCache.h" 16 | #import "SDImageCacheConfig.h" 17 | #import "SDWebImageCompat.h" 18 | #import "SDWebImageDecoder.h" 19 | #import "SDWebImageDownloader.h" 20 | #import "SDWebImageDownloaderOperation.h" 21 | #import "SDWebImageManager.h" 22 | #import "SDWebImageOperation.h" 23 | #import "SDWebImagePrefetcher.h" 24 | #import "UIButton+WebCache.h" 25 | #import "UIImage+GIF.h" 26 | #import "UIImage+MultiFormat.h" 27 | #import "UIImageView+HighlightedWebCache.h" 28 | #import "UIImageView+WebCache.h" 29 | #import "UIView+WebCache.h" 30 | #import "UIView+WebCacheOperation.h" 31 | 32 | FOUNDATION_EXPORT double SDWebImageVersionNumber; 33 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; 34 | 35 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/README.md: -------------------------------------------------------------------------------- 1 | # DMLPhotoBrowser 2 | 3 | [![CI Status](http://img.shields.io/travis/MrDML/DMLPhotoBrowser.svg?style=flat)](https://travis-ci.org/MrDML/DMLPhotoBrowser) 4 | [![Version](https://img.shields.io/cocoapods/v/DMLPhotoBrowser.svg?style=flat)](http://cocoapods.org/pods/DMLPhotoBrowser) 5 | [![License](https://img.shields.io/cocoapods/l/DMLPhotoBrowser.svg?style=flat)](http://cocoapods.org/pods/DMLPhotoBrowser) 6 | [![Platform](https://img.shields.io/cocoapods/p/DMLPhotoBrowser.svg?style=flat)](http://cocoapods.org/pods/DMLPhotoBrowser) 7 | 8 | ## Example 9 | 10 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 11 | 12 | ## Requirements 13 | 14 | ## Installation 15 | 16 | DMLPhotoBrowser is available through [CocoaPods](http://cocoapods.org). To install 17 | it, simply add the following line to your Podfile: 18 | 19 | ```ruby 20 | pod 'DMLPhotoBrowser' 21 | ``` 22 | 23 | ## Author 24 | 25 | MrDML, dml1630@163.com 26 | 27 | ## License 28 | 29 | DMLPhotoBrowser is available under the MIT license. See the LICENSE file for more info. 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 MrDML 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/M80AttributedLabelDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // M80AttributedLabelDefines.h 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #ifndef M80AttributedLabel_M80AttributedLabelDefines_h 10 | #define M80AttributedLabel_M80AttributedLabelDefines_h 11 | 12 | #import 13 | #import 14 | #import 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | typedef NS_OPTIONS(NSUInteger, M80ImageAlignment) { 19 | M80ImageAlignmentTop, 20 | M80ImageAlignmentCenter, 21 | M80ImageAlignmentBottom 22 | }; 23 | 24 | @class M80AttributedLabel; 25 | 26 | @protocol M80AttributedLabelDelegate 27 | - (void)m80AttributedLabel:(M80AttributedLabel *)label 28 | clickedOnLink:(id)linkData; 29 | 30 | @end 31 | 32 | typedef NSArray * _Nullable (^M80CustomDetectLinkBlock)(NSString * _Nullable text); 33 | 34 | //如果文本长度小于这个值,直接在UI线程做Link检测,否则都dispatch到共享线程 35 | #define M80MinAsyncDetectLinkLength 50 36 | 37 | NS_ASSUME_NONNULL_END 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/DMLPhotoBrowser" "$PODS_CONFIGURATION_BUILD_DIR/FLAnimatedImage" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"DMLPhotoBrowser" -l"FLAnimatedImage" -l"SDWebImage" -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "QuartzCore" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/DMLPhotoBrowser" "$PODS_CONFIGURATION_BUILD_DIR/FLAnimatedImage" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/DMLPhotoBrowser" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"DMLPhotoBrowser" -l"FLAnimatedImage" -l"SDWebImage" -framework "CoreGraphics" -framework "ImageIO" -framework "MobileCoreServices" -framework "QuartzCore" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 MrDML 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/NIMKit/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 netease-im 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Example/Pods/FLAnimatedImage/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2016 Flipboard 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Xiang Wangfeng (http://xiangwangfeng.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | @interface UIView (WebCacheOperation) 16 | 17 | /** 18 | * Set the image load operation (storage in a UIView based dictionary) 19 | * 20 | * @param operation the operation 21 | * @param key key for storing the operation 22 | */ 23 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 24 | 25 | /** 26 | * Cancel all operations for the current UIView and key 27 | * 28 | * @param key key for identifying the operations 29 | */ 30 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 31 | 32 | /** 33 | * Just remove the operations corresponding to the current UIView and key without cancelling them 34 | * 35 | * @param key key for identifying the operations 36 | */ 37 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface SDImageCacheConfig : NSObject 13 | 14 | /** 15 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 16 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 17 | */ 18 | @property (assign, nonatomic) BOOL shouldDecompressImages; 19 | 20 | /** 21 | * disable iCloud backup [defaults to YES] 22 | */ 23 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 24 | 25 | /** 26 | * use memory cache [defaults to YES] 27 | */ 28 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 29 | 30 | /** 31 | * The maximum length of time to keep an image in the cache, in seconds 32 | */ 33 | @property (assign, nonatomic) NSInteger maxCacheAge; 34 | 35 | /** 36 | * The maximum size of the cache, in bytes. 37 | */ 38 | @property (assign, nonatomic) NSUInteger maxCacheSize; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLPhotoItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoItem.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DMLPhotoItem : NSObject 12 | - (instancetype)initWithSourceView:(UIView *)sourceView thumbImage:(UIImage *)image imageUrl:(NSURL *)url; 13 | // 网络图片 14 | - (instancetype)initWithSourceView:(UIImageView *)sourceView imageUrl:(NSURL *)url; 15 | // 本地图片 16 | - (instancetype)initWithSourceView:(UIImageView *)sourceView image:(UIImage *)image; 17 | // 只有原图 18 | - (instancetype)initWithOriginalImageURL:(NSURL *)originalImageURL; 19 | 20 | /** 21 | 图片所属视图 (可选) 22 | */ 23 | @property (nonatomic, strong,readonly) UIView *sourceView; 24 | 25 | /** 26 | 缩略图 27 | */ 28 | @property (nonatomic, strong,readonly) UIImage *thumbImage; 29 | 30 | /** 31 | 原图 32 | */ 33 | @property (nonatomic, strong,readonly) NSURL *imageUrl; 34 | 35 | /** 36 | 原图URL 37 | */ 38 | @property (nonatomic, strong,readonly) NSURL *originalImageURL; 39 | 40 | 41 | /** 42 | 缩略图URL 43 | */ 44 | @property (nonatomic, strong,readonly) NSURL *thumbImageURL; 45 | 46 | 47 | /** 48 | 相册图片 49 | */ 50 | @property (nonatomic, strong,readonly) UIImage *image; 51 | 52 | 53 | 54 | @property (nonatomic, assign) BOOL finished; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/M80AttributedLabelAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // M80AttributedLabelAttachment.h 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "M80AttributedLabelDefines.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | void deallocCallback(void* ref); 14 | CGFloat ascentCallback(void *ref); 15 | CGFloat descentCallback(void *ref); 16 | CGFloat widthCallback(void* ref); 17 | 18 | @interface M80AttributedLabelAttachment : NSObject 19 | @property (nonatomic,strong) id content; 20 | @property (nonatomic,assign) UIEdgeInsets margin; 21 | @property (nonatomic,assign) M80ImageAlignment alignment; 22 | @property (nonatomic,assign) CGFloat fontAscent; 23 | @property (nonatomic,assign) CGFloat fontDescent; 24 | @property (nonatomic,assign) CGSize maxSize; 25 | 26 | 27 | + (M80AttributedLabelAttachment *)attachmentWith:(id)content 28 | margin:(UIEdgeInsets)margin 29 | alignment:(M80ImageAlignment)alignment 30 | maxSize:(CGSize)maxSize; 31 | 32 | - (CGSize)boxSize; 33 | 34 | @end 35 | 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoItem.h 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DMLPhotoItem : NSObject 12 | - (instancetype)initWithSourceView:(UIView *)sourceView thumbImage:(UIImage *)image imageUrl:(NSURL *)url; 13 | // 网络图片 14 | - (instancetype)initWithSourceView:(UIImageView *)sourceView imageUrl:(NSURL *)url; 15 | // 本地图片 16 | - (instancetype)initWithSourceView:(UIImageView *)sourceView image:(UIImage *)image; 17 | // 只有原图 18 | - (instancetype)initWithOriginalImageURL:(NSURL *)originalImageURL; 19 | 20 | /** 21 | 图片所属视图 (可选) 22 | */ 23 | @property (nonatomic, strong,readonly) UIView *sourceView; 24 | 25 | /** 26 | 缩略图 27 | */ 28 | @property (nonatomic, strong,readonly) UIImage *thumbImage; 29 | 30 | /** 31 | 原图 32 | */ 33 | @property (nonatomic, strong,readonly) NSURL *imageUrl; 34 | 35 | /** 36 | 原图URL 37 | */ 38 | @property (nonatomic, strong,readonly) NSURL *originalImageURL; 39 | 40 | 41 | /** 42 | 缩略图URL 43 | */ 44 | @property (nonatomic, strong,readonly) NSURL *thumbImageURL; 45 | 46 | 47 | /** 48 | 相册图片 49 | */ 50 | @property (nonatomic, strong,readonly) UIImage *image; 51 | 52 | 53 | 54 | @property (nonatomic, assign) BOOL finished; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "NSData+ImageContentType.h" 11 | 12 | 13 | @implementation NSData (ImageContentType) 14 | 15 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { 16 | if (!data) { 17 | return SDImageFormatUndefined; 18 | } 19 | 20 | uint8_t c; 21 | [data getBytes:&c length:1]; 22 | switch (c) { 23 | case 0xFF: 24 | return SDImageFormatJPEG; 25 | case 0x89: 26 | return SDImageFormatPNG; 27 | case 0x47: 28 | return SDImageFormatGIF; 29 | case 0x49: 30 | case 0x4D: 31 | return SDImageFormatTIFF; 32 | case 0x52: 33 | // R as RIFF for WEBP 34 | if (data.length < 12) { 35 | return SDImageFormatUndefined; 36 | } 37 | 38 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 39 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 40 | return SDImageFormatWebP; 41 | } 42 | } 43 | return SDImageFormatUndefined; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /DMLPhotoBrowser.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint DMLPhotoBrowser.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'DMLPhotoBrowser' 11 | s.version = '0.1.6' 12 | s.summary = 'DMLPhotoBrowser.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | The image browser supports both local and network. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/MrDML/DMLPhotoBrowser' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'MrDML' => 'dml1630@163.com' } 28 | s.source = { :git => 'https://github.com/MrDML/DMLPhotoBrowser.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '8.0' 32 | 33 | s.source_files = 'DMLPhotoBrowser/Classes/**/*' 34 | 35 | # s.resource_bundles = { 36 | # 'DMLPhotoBrowser' => ['DMLPhotoBrowser/Assets/*.png'] 37 | # } 38 | 39 | # s.public_header_files = 'Pod/Classes/**/*.h' 40 | # s.frameworks = 'UIKit' 41 | s.dependency 'FLAnimatedImage', '~> 1.0.12' 42 | s.dependency 'SDWebImage', '~> 4.1.0' 43 | end 44 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLPhotoItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoItem.m 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "DMLPhotoItem.h" 10 | 11 | @interface DMLPhotoItem () 12 | @property (nonatomic, strong,readwrite) UIView *sourceView; 13 | @property (nonatomic, strong,readwrite) UIImage *thumbImage; 14 | @property (nonatomic, strong,readwrite) NSURL *imageUrl; 15 | @property (nonatomic, strong,readwrite) NSURL *originalImageURL; 16 | @property (nonatomic, strong,readwrite) NSURL *thumbImageURL; 17 | @property (nonatomic, strong,readwrite) UIImage *image; 18 | @end 19 | 20 | @implementation DMLPhotoItem 21 | 22 | - (instancetype)initWithSourceView:(UIView *)sourceView thumbImage:(UIImage *)image imageUrl:(NSURL *)url { 23 | self = [super init]; 24 | if (self) { 25 | _sourceView = sourceView; 26 | _thumbImage = image; 27 | _imageUrl = url; 28 | } 29 | return self; 30 | } 31 | 32 | // 网络图片 33 | - (instancetype)initWithSourceView:(UIImageView *)sourceView imageUrl:(NSURL *)url { 34 | return [self initWithSourceView:sourceView thumbImage:sourceView.image imageUrl:url]; 35 | } 36 | 37 | // 本地图片 38 | - (instancetype)initWithSourceView:(UIImageView *)sourceView image:(UIImage *)image { 39 | self = [super init]; 40 | if (self) { 41 | _sourceView = sourceView; 42 | _thumbImage = image; 43 | _imageUrl = nil; 44 | _image = image; 45 | } 46 | return self; 47 | } 48 | 49 | // 只有原图和缩略图 不存在图片的归属图片 50 | - (instancetype)initWithOriginalImageURL:(NSURL *)originalImageURL 51 | { 52 | self = [super init]; 53 | if (self) { 54 | _imageUrl = originalImageURL; 55 | _originalImageURL = originalImageURL; 56 | } 57 | return self; 58 | } 59 | 60 | 61 | 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoItem.m 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "DMLPhotoItem.h" 10 | 11 | @interface DMLPhotoItem () 12 | @property (nonatomic, strong,readwrite) UIView *sourceView; 13 | @property (nonatomic, strong,readwrite) UIImage *thumbImage; 14 | @property (nonatomic, strong,readwrite) NSURL *imageUrl; 15 | @property (nonatomic, strong,readwrite) NSURL *originalImageURL; 16 | @property (nonatomic, strong,readwrite) NSURL *thumbImageURL; 17 | @property (nonatomic, strong,readwrite) UIImage *image; 18 | @end 19 | 20 | @implementation DMLPhotoItem 21 | 22 | - (instancetype)initWithSourceView:(UIView *)sourceView thumbImage:(UIImage *)image imageUrl:(NSURL *)url { 23 | self = [super init]; 24 | if (self) { 25 | _sourceView = sourceView; 26 | _thumbImage = image; 27 | _imageUrl = url; 28 | } 29 | return self; 30 | } 31 | 32 | // 网络图片 33 | - (instancetype)initWithSourceView:(UIImageView *)sourceView imageUrl:(NSURL *)url { 34 | return [self initWithSourceView:sourceView thumbImage:sourceView.image imageUrl:url]; 35 | } 36 | 37 | // 本地图片 38 | - (instancetype)initWithSourceView:(UIImageView *)sourceView image:(UIImage *)image { 39 | self = [super init]; 40 | if (self) { 41 | _sourceView = sourceView; 42 | _thumbImage = image; 43 | _imageUrl = nil; 44 | _image = image; 45 | } 46 | return self; 47 | } 48 | 49 | // 只有原图和缩略图 不存在图片的归属图片 50 | - (instancetype)initWithOriginalImageURL:(NSURL *)originalImageURL 51 | { 52 | self = [super init]; 53 | if (self) { 54 | _imageUrl = originalImageURL; 55 | _originalImageURL = originalImageURL; 56 | } 57 | return self; 58 | } 59 | 60 | 61 | 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Example/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FLAnimatedImageView.h 3 | // Flipboard 4 | // 5 | // Created by Raphael Schaad on 7/8/13. 6 | // Copyright (c) 2013-2015 Flipboard. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @class FLAnimatedImage; 13 | @protocol FLAnimatedImageViewDebugDelegate; 14 | 15 | 16 | // 17 | // An `FLAnimatedImageView` can take an `FLAnimatedImage` and plays it automatically when in view hierarchy and stops when removed. 18 | // The animation can also be controlled with the `UIImageView` methods `-start/stop/isAnimating`. 19 | // It is a fully compatible `UIImageView` subclass and can be used as a drop-in component to work with existing code paths expecting to display a `UIImage`. 20 | // Under the hood it uses a `CADisplayLink` for playback, which can be inspected with `currentFrame` & `currentFrameIndex`. 21 | // 22 | @interface FLAnimatedImageView : UIImageView 23 | 24 | // Setting `[UIImageView.image]` to a non-`nil` value clears out existing `animatedImage`. 25 | // And vice versa, setting `animatedImage` will initially populate the `[UIImageView.image]` to its `posterImage` and then start animating and hold `currentFrame`. 26 | @property (nonatomic, strong) FLAnimatedImage *animatedImage; 27 | @property (nonatomic, copy) void(^loopCompletionBlock)(NSUInteger loopCountRemaining); 28 | 29 | @property (nonatomic, strong, readonly) UIImage *currentFrame; 30 | @property (nonatomic, assign, readonly) NSUInteger currentFrameIndex; 31 | 32 | // The animation runloop mode. Enables playback during scrolling by allowing timer events (i.e. animation) with NSRunLoopCommonModes. 33 | // To keep scrolling smooth on single-core devices such as iPhone 3GS/4 and iPod Touch 4th gen, the default run loop mode is NSDefaultRunLoopMode. Otherwise, the default is NSDefaultRunLoopMode. 34 | @property (nonatomic, copy) NSString *runLoopMode; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "UIImage+GIF.h" 11 | #import 12 | #import "objc/runtime.h" 13 | #import "NSImage+WebCache.h" 14 | 15 | @implementation UIImage (GIF) 16 | 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 18 | if (!data) { 19 | return nil; 20 | } 21 | 22 | #if SD_MAC 23 | return [[UIImage alloc] initWithData:data]; 24 | #else 25 | 26 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); 27 | 28 | size_t count = CGImageSourceGetCount(source); 29 | 30 | UIImage *staticImage; 31 | 32 | if (count <= 1) { 33 | staticImage = [[UIImage alloc] initWithData:data]; 34 | } else { 35 | // we will only retrieve the 1st frame. the full GIF support is available via the FLAnimatedImageView category. 36 | // this here is only code to allow drawing animated images as static ones 37 | #if SD_WATCH 38 | CGFloat scale = 1; 39 | scale = [WKInterfaceDevice currentDevice].screenScale; 40 | #elif SD_UIKIT 41 | CGFloat scale = 1; 42 | scale = [UIScreen mainScreen].scale; 43 | #endif 44 | 45 | CGImageRef CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); 46 | #if SD_UIKIT || SD_WATCH 47 | UIImage *frameImage = [UIImage imageWithCGImage:CGImage scale:scale orientation:UIImageOrientationUp]; 48 | staticImage = [UIImage animatedImageWithImages:@[frameImage] duration:0.0f]; 49 | #endif 50 | CGImageRelease(CGImage); 51 | } 52 | 53 | CFRelease(source); 54 | 55 | return staticImage; 56 | #endif 57 | } 58 | 59 | - (BOOL)isGIF { 60 | return (self.images != nil); 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/DMLPhotoBrowser-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | NSPhotoLibraryUsageDescription 11 | 是否允许访问您的相册? 12 | CFBundleDevelopmentRegion 13 | en 14 | CFBundleDisplayName 15 | ${PRODUCT_NAME} 16 | CFBundleExecutable 17 | ${EXECUTABLE_NAME} 18 | CFBundleIdentifier 19 | $(PRODUCT_BUNDLE_IDENTIFIER) 20 | CFBundleInfoDictionaryVersion 21 | 6.0 22 | CFBundleName 23 | ${PRODUCT_NAME} 24 | CFBundlePackageType 25 | APPL 26 | CFBundleShortVersionString 27 | 1.0 28 | CFBundleSignature 29 | ???? 30 | CFBundleVersion 31 | 1.0 32 | LSRequiresIPhoneOS 33 | 34 | UILaunchStoryboardName 35 | LaunchScreen 36 | UIMainStoryboardFile 37 | Main 38 | UIRequiredDeviceCapabilities 39 | 40 | armv7 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UISupportedInterfaceOrientations~ipad 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationPortraitUpsideDown 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/DMLAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLAppDelegate.m 3 | // DMLPhotoBrowser 4 | // 5 | // Created by MrDML on 01/03/2018. 6 | // Copyright (c) 2018 MrDML. All rights reserved. 7 | // 8 | 9 | #import "DMLAppDelegate.h" 10 | 11 | @implementation DMLAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+HighlightedWebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "UIView+WebCacheOperation.h" 14 | #import "UIView+WebCache.h" 15 | 16 | @implementation UIImageView (HighlightedWebCache) 17 | 18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { 19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 20 | } 21 | 22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { 23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 28 | } 29 | 30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 32 | } 33 | 34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 35 | options:(SDWebImageOptions)options 36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 37 | completed:(nullable SDExternalCompletionBlock)completedBlock { 38 | __weak typeof(self)weakSelf = self; 39 | [self sd_internalSetImageWithURL:url 40 | placeholderImage:nil 41 | options:options 42 | operationKey:@"UIImageViewImageOperationHighlighted" 43 | setImageBlock:^(UIImage *image, NSData *imageData) { 44 | weakSelf.highlightedImage = image; 45 | } 46 | progress:progressBlock 47 | completed:completedBlock]; 48 | } 49 | 50 | @end 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/NSMutableAttributedString+M80.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableAttributedString+M80.m 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "NSMutableAttributedString+M80.h" 10 | 11 | @implementation NSMutableAttributedString (M80) 12 | 13 | - (void)m80_setTextColor:(UIColor*)color 14 | { 15 | [self m80_setTextColor:color range:NSMakeRange(0, [self length])]; 16 | } 17 | 18 | - (void)m80_setTextColor:(UIColor*)color range:(NSRange)range 19 | { 20 | if (color.CGColor) 21 | { 22 | [self removeAttribute:(NSString *)kCTForegroundColorAttributeName range:range]; 23 | 24 | [self addAttribute:(NSString *)kCTForegroundColorAttributeName 25 | value:(id)color.CGColor 26 | range:range]; 27 | } 28 | 29 | } 30 | 31 | 32 | - (void)m80_setFont:(UIFont*)font 33 | { 34 | [self m80_setFont:font range:NSMakeRange(0, [self length])]; 35 | } 36 | 37 | - (void)m80_setFont:(UIFont*)font range:(NSRange)range 38 | { 39 | if (font) 40 | { 41 | [self removeAttribute:(NSString*)kCTFontAttributeName range:range]; 42 | 43 | CTFontRef fontRef = CTFontCreateWithName((CFStringRef)font.fontName, font.pointSize, nil); 44 | if (nil != fontRef) 45 | { 46 | [self addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)fontRef range:range]; 47 | CFRelease(fontRef); 48 | } 49 | } 50 | } 51 | 52 | - (void)m80_setUnderlineStyle:(CTUnderlineStyle)style 53 | modifier:(CTUnderlineStyleModifiers)modifier 54 | { 55 | [self m80_setUnderlineStyle:style 56 | modifier:modifier 57 | range:NSMakeRange(0, self.length)]; 58 | } 59 | 60 | - (void)m80_setUnderlineStyle:(CTUnderlineStyle)style 61 | modifier:(CTUnderlineStyleModifiers)modifier 62 | range:(NSRange)range 63 | { 64 | [self removeAttribute:(NSString *)kCTUnderlineColorAttributeName range:range]; 65 | [self addAttribute:(NSString *)kCTUnderlineStyleAttributeName 66 | value:[NSNumber numberWithInt:(style|modifier)] 67 | range:range]; 68 | 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIView+WebCacheOperation.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | 15 | static char loadOperationKey; 16 | 17 | typedef NSMutableDictionary SDOperationsDictionary; 18 | 19 | @implementation UIView (WebCacheOperation) 20 | 21 | - (SDOperationsDictionary *)operationDictionary { 22 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 23 | if (operations) { 24 | return operations; 25 | } 26 | operations = [NSMutableDictionary dictionary]; 27 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return operations; 29 | } 30 | 31 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { 32 | if (key) { 33 | [self sd_cancelImageLoadOperationWithKey:key]; 34 | if (operation) { 35 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 36 | operationDictionary[key] = operation; 37 | } 38 | } 39 | } 40 | 41 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { 42 | // Cancel in progress downloader from queue 43 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 44 | id operations = operationDictionary[key]; 45 | if (operations) { 46 | if ([operations isKindOfClass:[NSArray class]]) { 47 | for (id operation in operations) { 48 | if (operation) { 49 | [operation cancel]; 50 | } 51 | } 52 | } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){ 53 | [(id) operations cancel]; 54 | } 55 | [operationDictionary removeObjectForKey:key]; 56 | } 57 | } 58 | 59 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { 60 | if (key) { 61 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 62 | [operationDictionary removeObjectForKey:key]; 63 | } 64 | } 65 | 66 | @end 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DMLPhotoBrowser 2 | 3 | [![CI Status](http://img.shields.io/travis/MrDML/DMLPhotoBrowser.svg?style=flat)](https://travis-ci.org/MrDML/DMLPhotoBrowser) 4 | [![Version](https://img.shields.io/cocoapods/v/DMLPhotoBrowser.svg?style=flat)](http://cocoapods.org/pods/DMLPhotoBrowser) 5 | [![License](https://img.shields.io/cocoapods/l/DMLPhotoBrowser.svg?style=flat)](http://cocoapods.org/pods/DMLPhotoBrowser) 6 | [![Platform](https://img.shields.io/cocoapods/p/DMLPhotoBrowser.svg?style=flat)](http://cocoapods.org/pods/DMLPhotoBrowser) 7 | 8 | ## Example 9 | 10 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 11 | 12 | ## Requirements&&demonstration 13 | ![Demo](https://github.com/MrDML/DMLPhotoBrowser/blob/master/photo.gif) 14 | 15 | 16 | ## Installation 17 | 18 | DMLPhotoBrowser is available through [CocoaPods](http://cocoapods.org). To install 19 | it, simply add the following line to your Podfile: 20 | 21 | ```ruby 22 | pod 'DMLPhotoBrowser', '~> 0.1.6' 23 | ``` 24 | 25 | ## Use 26 | *注意此框架依赖 FLAnimatedImage和SDWebImage,下面是具体如何使用(请参考demo,欢迎Issues)* 27 |

本地/相册图片浏览

28 |
 
29 |     NSMutableArray *photoItems = [NSMutableArray array];
30 |     int i = 0;
31 |     for (UIImage *image in self.images) {
32 |         UIImageView *imageViewSource = self.bgview.subviews[i];
33 |         DMLPhotoItem *item = [[DMLPhotoItem alloc] initWithSourceView:imageViewSource image:image];
34 |         [photoItems addObject:item];
35 |         i ++;
36 |     }
37 |     DMLPhotoBrowser *Browser = [[DMLPhotoBrowser alloc] initWithPhotoItems:photoItems selectedIndex:imageView.tag];
38 |     [Browser showPhotoBrowser];
39 | 
40 |

网络图片浏览

41 |
42 |     NSMutableArray *photoItems = [NSMutableArray array];
43 |     int i = 0;
44 |     for (NSString *url in self.originalURLs) { 
45 |         FLAnimatedImageView *imageViewSource = self.bgview.subviews[i];
46 |         DMLPhotoItem *item = [[DMLPhotoItem alloc] initWithSourceView:imageViewSource thumbImage:imageViewSource.image       imageUrl:[NSURL URLWithString:url]];
47 |         [photoItems addObject:item];
48 |         i ++;
49 |     }
50 |     DMLPhotoBrowser *Browser = [[DMLPhotoBrowser alloc] initWithPhotoItems:photoItems selectedIndex:imageView.tag];
51 |     [Browser showPhotoBrowser];
52 | 
53 | 54 | ## Author 55 | 56 | NickName:MrDML, E-Mail:dml1630@163.com, QQ:1969339388 57 | 58 | ## License 59 | 60 | DMLPhotoBrowser is available under the MIT license. See the LICENSE file for more info. 61 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLProgressShapeLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLProgressShapeLayer.m 3 | // DMLPhotoBrowserExample 4 | // 5 | // Created by 戴明亮 on 2017/12/21. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "DMLProgressShapeLayer.h" 10 | 11 | @interface DMLProgressShapeLayer() 12 | 13 | @property (nonatomic, assign) BOOL isStartAnimation; 14 | 15 | @end 16 | 17 | @implementation DMLProgressShapeLayer 18 | 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame 21 | { 22 | self = [super init]; 23 | if (self) { 24 | self.frame = frame; 25 | self.cornerRadius = self.frame.size.width * 0.5; 26 | self.fillColor = [UIColor clearColor].CGColor; 27 | self.strokeColor = [UIColor whiteColor].CGColor; 28 | self.lineWidth = 4; 29 | self.lineCap = kCALineCapRound; 30 | self.strokeStart = 0; 31 | self.strokeEnd = 0.01; 32 | self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5].CGColor; 33 | 34 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.frame.size.width * 0.5, self.frame.size.height * 0.5) radius:(self.frame.size.width * 0.5 - 2) startAngle:0 endAngle:2 * M_PI clockwise:YES]; 35 | self.path = path.CGPath; 36 | 37 | // app 进入后台 38 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; 39 | } 40 | 41 | return self; 42 | 43 | } 44 | 45 | 46 | 47 | - (void)applicationDidBecomeActive:(NSNotification *)notiofication 48 | { 49 | if (self.isStartAnimation) { 50 | [self startProgressAnimation]; 51 | } 52 | } 53 | 54 | 55 | /** 56 | 开始动画 57 | */ 58 | - (void)startProgressAnimation 59 | { 60 | self.isStartAnimation = YES; 61 | [self startAmintionWithAngle:M_PI]; 62 | } 63 | 64 | 65 | - (void)startAmintionWithAngle:(CGFloat)angle 66 | { 67 | self.strokeEnd = 0.4; 68 | 69 | CABasicAnimation *ani = [CABasicAnimation animation]; 70 | ani.keyPath = @"transform.rotation.z"; 71 | ani.toValue = @(angle); 72 | ani.duration = 0.4; 73 | //cumulative=YES的话,从上一次动画结束的位置继续动画。cumulative=NO的话又回到最开始的位置再次动画。 74 | ani.cumulative = YES; 75 | ani.repeatCount = HUGE; 76 | [self addAnimation:ani forKey:nil]; 77 | 78 | } 79 | 80 | 81 | /** 82 | 停止动画 83 | */ 84 | - (void)stopProgressAnimation 85 | { 86 | self.isStartAnimation = NO; 87 | [self removeAllAnimations]; 88 | } 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLProgressShapeLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLProgressShapeLayer.m 3 | // DMLPhotoBrowserExample 4 | // 5 | // Created by 戴明亮 on 2017/12/21. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "DMLProgressShapeLayer.h" 10 | 11 | @interface DMLProgressShapeLayer() 12 | 13 | @property (nonatomic, assign) BOOL isStartAnimation; 14 | 15 | @end 16 | 17 | @implementation DMLProgressShapeLayer 18 | 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame 21 | { 22 | self = [super init]; 23 | if (self) { 24 | self.frame = frame; 25 | self.cornerRadius = self.frame.size.width * 0.5; 26 | self.fillColor = [UIColor clearColor].CGColor; 27 | self.strokeColor = [UIColor whiteColor].CGColor; 28 | self.lineWidth = 4; 29 | self.lineCap = kCALineCapRound; 30 | self.strokeStart = 0; 31 | self.strokeEnd = 0.01; 32 | self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5].CGColor; 33 | 34 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.frame.size.width * 0.5, self.frame.size.height * 0.5) radius:(self.frame.size.width * 0.5 - 2) startAngle:0 endAngle:2 * M_PI clockwise:YES]; 35 | self.path = path.CGPath; 36 | 37 | // app 进入后台 38 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; 39 | } 40 | 41 | return self; 42 | 43 | } 44 | 45 | 46 | 47 | - (void)applicationDidBecomeActive:(NSNotification *)notiofication 48 | { 49 | if (self.isStartAnimation) { 50 | [self startProgressAnimation]; 51 | } 52 | } 53 | 54 | 55 | /** 56 | 开始动画 57 | */ 58 | - (void)startProgressAnimation 59 | { 60 | self.isStartAnimation = YES; 61 | [self startAmintionWithAngle:M_PI]; 62 | } 63 | 64 | 65 | - (void)startAmintionWithAngle:(CGFloat)angle 66 | { 67 | self.strokeEnd = 0.4; 68 | 69 | CABasicAnimation *ani = [CABasicAnimation animation]; 70 | ani.keyPath = @"transform.rotation.z"; 71 | ani.toValue = @(angle); 72 | ani.duration = 0.4; 73 | //cumulative=YES的话,从上一次动画结束的位置继续动画。cumulative=NO的话又回到最开始的位置再次动画。 74 | ani.cumulative = YES; 75 | ani.repeatCount = HUGE; 76 | [self addAnimation:ani forKey:nil]; 77 | 78 | } 79 | 80 | 81 | /** 82 | 停止动画 83 | */ 84 | - (void)stopProgressAnimation 85 | { 86 | self.isStartAnimation = NO; 87 | [self removeAllAnimations]; 88 | } 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #import "objc/runtime.h" 12 | 13 | #if !__has_feature(objc_arc) 14 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 15 | #endif 16 | 17 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { 18 | if (!image) { 19 | return nil; 20 | } 21 | 22 | #if SD_MAC 23 | return image; 24 | #elif SD_UIKIT || SD_WATCH 25 | if ((image.images).count > 0) { 26 | NSMutableArray *scaledImages = [NSMutableArray array]; 27 | 28 | for (UIImage *tempImage in image.images) { 29 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 30 | } 31 | 32 | UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 33 | #ifdef SD_WEBP 34 | if (animatedImage) { 35 | SEL sd_webpLoopCount = NSSelectorFromString(@"sd_webpLoopCount"); 36 | NSNumber *value = objc_getAssociatedObject(image, sd_webpLoopCount); 37 | NSInteger loopCount = value.integerValue; 38 | if (loopCount) { 39 | objc_setAssociatedObject(animatedImage, sd_webpLoopCount, @(loopCount), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 40 | } 41 | } 42 | #endif 43 | return animatedImage; 44 | } else { 45 | #if SD_WATCH 46 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { 47 | #elif SD_UIKIT 48 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 49 | #endif 50 | CGFloat scale = 1; 51 | if (key.length >= 8) { 52 | NSRange range = [key rangeOfString:@"@2x."]; 53 | if (range.location != NSNotFound) { 54 | scale = 2.0; 55 | } 56 | 57 | range = [key rangeOfString:@"@3x."]; 58 | if (range.location != NSNotFound) { 59 | scale = 3.0; 60 | } 61 | } 62 | 63 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 64 | image = scaledImage; 65 | } 66 | return image; 67 | } 68 | #endif 69 | } 70 | 71 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 72 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIView+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData); 16 | 17 | @interface UIView (WebCache) 18 | 19 | /** 20 | * Get the current image URL. 21 | * 22 | * Note that because of the limitations of categories this property can get out of sync 23 | * if you use setImage: directly. 24 | */ 25 | - (nullable NSURL *)sd_imageURL; 26 | 27 | /** 28 | * Set the imageView `image` with an `url` and optionally a placeholder image. 29 | * 30 | * The download is asynchronous and cached. 31 | * 32 | * @param url The url for the image. 33 | * @param placeholder The image to be set initially, until the image request finishes. 34 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 35 | * @param operationKey A string to be used as the operation key. If nil, will use the class name 36 | * @param setImageBlock Block used for custom set image code 37 | * @param progressBlock A block called while image is downloading 38 | * @note the progress block is executed on a background queue 39 | * @param completedBlock A block called when operation has been completed. This block has no return value 40 | * and takes the requested UIImage as first parameter. In case of error the image parameter 41 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 42 | * indicating if the image was retrieved from the local cache or from the network. 43 | * The fourth parameter is the original image url. 44 | */ 45 | - (void)sd_internalSetImageWithURL:(nullable NSURL *)url 46 | placeholderImage:(nullable UIImage *)placeholder 47 | options:(SDWebImageOptions)options 48 | operationKey:(nullable NSString *)operationKey 49 | setImageBlock:(nullable SDSetImageBlock)setImageBlock 50 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 51 | completed:(nullable SDExternalCompletionBlock)completedBlock; 52 | 53 | /** 54 | * Cancel the current download 55 | */ 56 | - (void)sd_cancelCurrentImageLoad; 57 | 58 | #if SD_UIKIT 59 | 60 | #pragma mark - Activity indicator 61 | 62 | /** 63 | * Show activity UIActivityIndicatorView 64 | */ 65 | - (void)sd_setShowActivityIndicatorView:(BOOL)show; 66 | 67 | /** 68 | * set desired UIActivityIndicatorViewStyle 69 | * 70 | * @param style The style of the UIActivityIndicatorView 71 | */ 72 | - (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style; 73 | 74 | - (BOOL)sd_showActivityIndicatorView; 75 | - (void)sd_addActivityIndicator; 76 | - (void)sd_removeActivityIndicator; 77 | 78 | #endif 79 | 80 | @end 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/M80AttributedLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // M80AttributedLabel.h 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-9-1. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "M80AttributedLabelDefines.h" 10 | #import "NSMutableAttributedString+M80.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @class M80AttributedLabelURL; 15 | 16 | @interface M80AttributedLabel : UIView 17 | @property (nonatomic,weak,nullable) id delegate; 18 | @property (nonatomic,strong,nullable) UIFont *font; //字体 19 | @property (nonatomic,strong,nullable) UIColor *textColor; //文字颜色 20 | @property (nonatomic,strong,nullable) UIColor *highlightColor; //链接点击时背景高亮色 21 | @property (nonatomic,strong,nullable) UIColor *linkColor; //链接色 22 | @property (nonatomic,strong,nullable) UIColor *shadowColor; //阴影颜色 23 | @property (nonatomic,assign) CGSize shadowOffset; //阴影offset 24 | @property (nonatomic,assign) CGFloat shadowBlur; //阴影半径 25 | @property (nonatomic,assign) BOOL underLineForLink; //链接是否带下划线 26 | @property (nonatomic,assign) BOOL autoDetectLinks; //自动检测 27 | @property (nonatomic,assign) NSInteger numberOfLines; //行数 28 | @property (nonatomic,assign) CTTextAlignment textAlignment; //文字排版样式 29 | @property (nonatomic,assign) CTLineBreakMode lineBreakMode; //LineBreakMode 30 | @property (nonatomic,assign) CGFloat lineSpacing; //行间距 31 | @property (nonatomic,assign) CGFloat paragraphSpacing; //段间距 32 | @property (nonatomic,copy,nullable) NSString *text; //普通文本 33 | @property (nonatomic,copy,nullable) NSAttributedString *attributedText; //属性文本 34 | 35 | 36 | 37 | //添加文本 38 | - (void)appendText:(NSString *)text; 39 | - (void)appendAttributedText:(NSAttributedString *)attributedText; 40 | 41 | //图片 42 | - (void)appendImage:(UIImage *)image; 43 | - (void)appendImage:(UIImage *)image 44 | maxSize:(CGSize)maxSize; 45 | - (void)appendImage:(UIImage *)image 46 | maxSize:(CGSize)maxSize 47 | margin:(UIEdgeInsets)margin; 48 | - (void)appendImage:(UIImage *)image 49 | maxSize:(CGSize)maxSize 50 | margin:(UIEdgeInsets)margin 51 | alignment:(M80ImageAlignment)alignment; 52 | 53 | //UI控件 54 | - (void)appendView:(UIView *)view; 55 | - (void)appendView:(UIView *)view 56 | margin:(UIEdgeInsets)margin; 57 | - (void)appendView:(UIView *)view 58 | margin:(UIEdgeInsets)margin 59 | alignment:(M80ImageAlignment)alignment; 60 | 61 | 62 | //添加自定义链接 63 | - (void)addCustomLink:(id)linkData 64 | forRange:(NSRange)range; 65 | 66 | - (void)addCustomLink:(id)linkData 67 | forRange:(NSRange)range 68 | linkColor:(UIColor *)color; 69 | 70 | 71 | //大小 72 | - (CGSize)sizeThatFits:(CGSize)size; 73 | 74 | //设置全局的自定义Link检测Block(详见M80AttributedLabelURL) 75 | + (void)setCustomDetectMethod:(nullable M80CustomDetectLinkBlock)block; 76 | 77 | @end 78 | 79 | NS_ASSUME_NONNULL_END 80 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/M80AttributedLabelURL.m: -------------------------------------------------------------------------------- 1 | // 2 | // M80AttributedLabelURL.m 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "M80AttributedLabelURL.h" 10 | 11 | static NSString *M80URLExpression = @"((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((:[0-9]+)?)((?:\\/[\\+~%\\/\\.\\w\\-]*)?\\??(?:[\\-\\+=&;%@\\.\\w]*)#?(?:[\\.\\!\\/\\\\\\w]*))?)"; 12 | 13 | static M80CustomDetectLinkBlock customDetectBlock = nil; 14 | 15 | static NSString *M80URLExpressionKey = @"M80URLExpressionKey"; 16 | 17 | 18 | @implementation M80AttributedLabelURL 19 | 20 | + (M80AttributedLabelURL *)urlWithLinkData:(id)linkData 21 | range:(NSRange)range 22 | color:(UIColor *)color 23 | { 24 | M80AttributedLabelURL *url = [[M80AttributedLabelURL alloc]init]; 25 | url.linkData = linkData; 26 | url.range = range; 27 | url.color = color; 28 | return url; 29 | 30 | } 31 | 32 | 33 | + (NSArray *)detectLinks:(NSString *)plainText 34 | { 35 | if (customDetectBlock) 36 | { 37 | return customDetectBlock(plainText); 38 | } 39 | else 40 | { 41 | NSMutableArray *links = nil; 42 | if ([plainText length]) 43 | { 44 | links = [NSMutableArray array]; 45 | NSRegularExpression *urlRegex = [M80AttributedLabelURL urlExpression]; 46 | [urlRegex enumerateMatchesInString:plainText 47 | options:0 48 | range:NSMakeRange(0, [plainText length]) 49 | usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { 50 | NSRange range = result.range; 51 | NSString *text = [plainText substringWithRange:range]; 52 | M80AttributedLabelURL *link = [M80AttributedLabelURL urlWithLinkData:text 53 | range:range 54 | color:nil]; 55 | [links addObject:link]; 56 | }]; 57 | } 58 | return links; 59 | } 60 | } 61 | 62 | + (NSRegularExpression *)urlExpression 63 | { 64 | NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary]; 65 | NSRegularExpression *exp = dict[M80URLExpressionKey]; 66 | if (exp == nil) 67 | { 68 | exp = [NSRegularExpression regularExpressionWithPattern:M80URLExpression 69 | options:NSRegularExpressionCaseInsensitive 70 | error:nil]; 71 | dict[M80URLExpressionKey] = exp; 72 | } 73 | return exp; 74 | } 75 | 76 | + (void)setCustomDetectMethod:(M80CustomDetectLinkBlock)block 77 | { 78 | customDetectBlock = [block copy]; 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | // Apple's defines from TargetConditionals.h are a bit weird. 17 | // Seems like TARGET_OS_MAC is always defined (on all platforms). 18 | // To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms 19 | #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH 20 | #define SD_MAC 1 21 | #else 22 | #define SD_MAC 0 23 | #endif 24 | 25 | // iOS and tvOS are very similar, UIKit exists on both platforms 26 | // Note: watchOS also has UIKit, but it's very limited 27 | #if TARGET_OS_IOS || TARGET_OS_TV 28 | #define SD_UIKIT 1 29 | #else 30 | #define SD_UIKIT 0 31 | #endif 32 | 33 | #if TARGET_OS_IOS 34 | #define SD_IOS 1 35 | #else 36 | #define SD_IOS 0 37 | #endif 38 | 39 | #if TARGET_OS_TV 40 | #define SD_TV 1 41 | #else 42 | #define SD_TV 0 43 | #endif 44 | 45 | #if TARGET_OS_WATCH 46 | #define SD_WATCH 1 47 | #else 48 | #define SD_WATCH 0 49 | #endif 50 | 51 | 52 | #if SD_MAC 53 | #import 54 | #ifndef UIImage 55 | #define UIImage NSImage 56 | #endif 57 | #ifndef UIImageView 58 | #define UIImageView NSImageView 59 | #endif 60 | #ifndef UIView 61 | #define UIView NSView 62 | #endif 63 | #else 64 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 65 | #error SDWebImage doesn't support Deployment Target version < 5.0 66 | #endif 67 | 68 | #if SD_UIKIT 69 | #import 70 | #endif 71 | #if SD_WATCH 72 | #import 73 | #endif 74 | #endif 75 | 76 | #ifndef NS_ENUM 77 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 78 | #endif 79 | 80 | #ifndef NS_OPTIONS 81 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 82 | #endif 83 | 84 | #if OS_OBJECT_USE_OBJC 85 | #undef SDDispatchQueueRelease 86 | #undef SDDispatchQueueSetterSementics 87 | #define SDDispatchQueueRelease(q) 88 | #define SDDispatchQueueSetterSementics strong 89 | #else 90 | #undef SDDispatchQueueRelease 91 | #undef SDDispatchQueueSetterSementics 92 | #define SDDispatchQueueRelease(q) (dispatch_release(q)) 93 | #define SDDispatchQueueSetterSementics assign 94 | #endif 95 | 96 | FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 97 | 98 | typedef void(^SDWebImageNoParamsBlock)(void); 99 | 100 | FOUNDATION_EXPORT NSString *const SDWebImageErrorDomain; 101 | 102 | #ifndef dispatch_main_async_safe 103 | #define dispatch_main_async_safe(block)\ 104 | if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) {\ 105 | block();\ 106 | } else {\ 107 | dispatch_async(dispatch_get_main_queue(), block);\ 108 | } 109 | #endif 110 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Category/FLAnimatedImageView+SD_WebCache.m: -------------------------------------------------------------------------------- 1 | // 2 | // FLAnimatedImageView+SD_WebCache.m 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/29. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "FLAnimatedImageView+SD_WebCache.h" 10 | // iOS 和 tvOS 11 | #if SD_UIKIT 12 | #import "objc/runtime.h" 13 | #import "UIView+WebCacheOperation.h" 14 | #import "UIView+WebCache.h" 15 | #import "FLAnimatedImage.h" 16 | #import "UIImageView+WebCache.h" 17 | #import "NSData+ImageContentType.h" 18 | #import "FLAnimatedImageView.h" 19 | #import "SDWebImageManager.h" 20 | 21 | @implementation FLAnimatedImageView (SD_WebCache) 22 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 23 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 27 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 28 | } 29 | 30 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 31 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 32 | } 33 | 34 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 35 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 36 | } 37 | 38 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 39 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 40 | } 41 | 42 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 43 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 44 | } 45 | 46 | - (void)sd_setImageWithURL:(nullable NSURL *)url 47 | placeholderImage:(nullable UIImage *)placeholder 48 | options:(SDWebImageOptions)options 49 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 50 | completed:(nullable SDExternalCompletionBlock)completedBlock { 51 | __weak typeof(self)weakSelf = self; 52 | [self sd_internalSetImageWithURL:url 53 | placeholderImage:placeholder 54 | options:options 55 | operationKey:nil 56 | setImageBlock:^(UIImage *image, NSData *imageData) { 57 | SDImageFormat imageFormat = [NSData sd_imageFormatForImageData:imageData]; 58 | if (imageFormat == SDImageFormatGIF) { 59 | weakSelf.animatedImage = [FLAnimatedImage animatedImageWithGIFData:imageData]; 60 | weakSelf.image = nil; 61 | } else { 62 | weakSelf.image = image; 63 | weakSelf.animatedImage = nil; 64 | } 65 | } 66 | progress:progressBlock 67 | completed:completedBlock]; 68 | } 69 | @end 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /DMLPhotoBrowser/Classes/DMLPhotoCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoCell.m 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "DMLPhotoCell.h" 10 | 11 | @interface DMLPhotoCell () 12 | @property (nonatomic, strong)DMLPhotoScrollView *photoScrollView; 13 | @property (nonatomic, strong) UICollectionView *collectionView; 14 | @property (nonatomic, strong)DMLProgressShapeLayer *progressLayer; 15 | @end 16 | 17 | 18 | @implementation DMLPhotoCell 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame 21 | { 22 | self = [super initWithFrame:frame]; 23 | if (self) { 24 | _photoScrollView = [[DMLPhotoScrollView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)]; 25 | [self.contentView addSubview:_photoScrollView]; 26 | 27 | _progressLayer = [[DMLProgressShapeLayer alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; 28 | _progressLayer.backgroundColor = [UIColor darkGrayColor].CGColor; 29 | _progressLayer.position = CGPointMake(self.frame.size.width/2, self.frame.size.height/2); 30 | _progressLayer.hidden = YES; 31 | [self.layer addSublayer:_progressLayer]; 32 | 33 | } 34 | return self; 35 | } 36 | 37 | 38 | - (void)layoutSubviews 39 | { 40 | [super layoutSubviews]; 41 | _photoScrollView.bounds = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); 42 | _photoScrollView.center = CGPointMake(self.frame.size.width * 0.5, self.frame.size.height * 0.5); 43 | } 44 | 45 | 46 | - (void)setPhotoItem:(DMLPhotoItem *)photoItem 47 | { 48 | _photoItem = photoItem; 49 | 50 | _photoScrollView.photoItem =photoItem; 51 | 52 | __weak typeof(self)weakSelf = self; 53 | _photoScrollView.progressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL *targetURL) { 54 | dispatch_async(dispatch_get_main_queue(), ^{ 55 | __strong typeof(weakSelf) strongSelf = weakSelf; 56 | double progress = (double)receivedSize / expectedSize; 57 | strongSelf.progressLayer.hidden = NO; 58 | strongSelf.progressLayer.strokeEnd = MAX(progress, 0.01); 59 | }); 60 | }; 61 | 62 | _photoScrollView.completedBolck = ^(UIImage *image, NSURL *imageURL) { 63 | dispatch_async(dispatch_get_main_queue(), ^{ 64 | weakSelf.progressLayer.hidden = YES; 65 | [weakSelf.progressLayer stopProgressAnimation]; 66 | }); 67 | }; 68 | 69 | } 70 | 71 | /* 快速创建collectionCell */ 72 | + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath 73 | { 74 | 75 | DMLPhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"indetifire" forIndexPath:indexPath]; 76 | 77 | CGRect rect = cell.frame; 78 | rect.size.width = collectionView.frame.size.width - 20; 79 | cell.frame = rect; 80 | 81 | cell.collectionView = collectionView; 82 | // 设置标志 83 | // cell.photoView.tag = indexPath.item; 84 | return cell; 85 | } 86 | 87 | 88 | + (DMLPhotoScrollView *)collectionView:(UICollectionView *)collectionView PhotoScrollViewforPage:(NSInteger)page 89 | { 90 | 91 | [collectionView layoutIfNeeded]; 92 | // 有时候返回 nil,有时候成功。 在调用之前调用[collectionView layoutIfNeeded]; 93 | DMLPhotoCell *cell = (DMLPhotoCell*)[collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:page inSection:0]]; 94 | return cell.photoScrollView; 95 | 96 | } 97 | 98 | 99 | - (void)progressLayerisHidden:(BOOL)hidden 100 | { 101 | self.progressLayer.hidden = hidden; 102 | } 103 | 104 | 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Example/Pods/DMLPhotoBrowser/DMLPhotoBrowser/Classes/DMLPhotoCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DMLPhotoCell.m 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "DMLPhotoCell.h" 10 | 11 | @interface DMLPhotoCell () 12 | @property (nonatomic, strong)DMLPhotoScrollView *photoScrollView; 13 | @property (nonatomic, strong) UICollectionView *collectionView; 14 | @property (nonatomic, strong)DMLProgressShapeLayer *progressLayer; 15 | @end 16 | 17 | 18 | @implementation DMLPhotoCell 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame 21 | { 22 | self = [super initWithFrame:frame]; 23 | if (self) { 24 | _photoScrollView = [[DMLPhotoScrollView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)]; 25 | [self.contentView addSubview:_photoScrollView]; 26 | 27 | _progressLayer = [[DMLProgressShapeLayer alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; 28 | _progressLayer.backgroundColor = [UIColor darkGrayColor].CGColor; 29 | _progressLayer.position = CGPointMake(self.frame.size.width/2, self.frame.size.height/2); 30 | _progressLayer.hidden = YES; 31 | [self.layer addSublayer:_progressLayer]; 32 | 33 | } 34 | return self; 35 | } 36 | 37 | 38 | - (void)layoutSubviews 39 | { 40 | [super layoutSubviews]; 41 | _photoScrollView.bounds = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); 42 | _photoScrollView.center = CGPointMake(self.frame.size.width * 0.5, self.frame.size.height * 0.5); 43 | } 44 | 45 | 46 | - (void)setPhotoItem:(DMLPhotoItem *)photoItem 47 | { 48 | _photoItem = photoItem; 49 | 50 | _photoScrollView.photoItem =photoItem; 51 | 52 | __weak typeof(self)weakSelf = self; 53 | _photoScrollView.progressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL *targetURL) { 54 | dispatch_async(dispatch_get_main_queue(), ^{ 55 | __strong typeof(weakSelf) strongSelf = weakSelf; 56 | double progress = (double)receivedSize / expectedSize; 57 | strongSelf.progressLayer.hidden = NO; 58 | strongSelf.progressLayer.strokeEnd = MAX(progress, 0.01); 59 | }); 60 | }; 61 | 62 | _photoScrollView.completedBolck = ^(UIImage *image, NSURL *imageURL) { 63 | dispatch_async(dispatch_get_main_queue(), ^{ 64 | weakSelf.progressLayer.hidden = YES; 65 | [weakSelf.progressLayer stopProgressAnimation]; 66 | }); 67 | }; 68 | 69 | } 70 | 71 | /* 快速创建collectionCell */ 72 | + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath 73 | { 74 | 75 | DMLPhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"indetifire" forIndexPath:indexPath]; 76 | 77 | CGRect rect = cell.frame; 78 | rect.size.width = collectionView.frame.size.width - 20; 79 | cell.frame = rect; 80 | 81 | cell.collectionView = collectionView; 82 | // 设置标志 83 | // cell.photoView.tag = indexPath.item; 84 | return cell; 85 | } 86 | 87 | 88 | + (DMLPhotoScrollView *)collectionView:(UICollectionView *)collectionView PhotoScrollViewforPage:(NSInteger)page 89 | { 90 | 91 | [collectionView layoutIfNeeded]; 92 | // 有时候返回 nil,有时候成功。 在调用之前调用[collectionView layoutIfNeeded]; 93 | DMLPhotoCell *cell = (DMLPhotoCell*)[collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:page inSection:0]]; 94 | return cell.photoScrollView; 95 | 96 | } 97 | 98 | 99 | - (void)progressLayerisHidden:(BOOL)hidden 100 | { 101 | self.progressLayer.hidden = hidden; 102 | } 103 | 104 | 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## DMLPhotoBrowser 5 | 6 | Copyright (c) 2018 MrDML 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## FLAnimatedImage 28 | 29 | The MIT License (MIT) 30 | 31 | Copyright (c) 2014-2016 Flipboard 32 | 33 | Permission is hereby granted, free of charge, to any person obtaining a copy 34 | of this software and associated documentation files (the "Software"), to deal 35 | in the Software without restriction, including without limitation the rights 36 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 37 | copies of the Software, and to permit persons to whom the Software is 38 | furnished to do so, subject to the following conditions: 39 | 40 | The above copyright notice and this permission notice shall be included in all 41 | copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 44 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 45 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 46 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 47 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 48 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 49 | SOFTWARE. 50 | 51 | 52 | ## SDWebImage 53 | 54 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a copy 57 | of this software and associated documentation files (the "Software"), to deal 58 | in the Software without restriction, including without limitation the rights 59 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 60 | copies of the Software, and to permit persons to whom the Software is furnished 61 | to do so, subject to the following conditions: 62 | 63 | The above copyright notice and this permission notice shall be included in all 64 | copies or substantial portions of the Software. 65 | 66 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 67 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 68 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 69 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 70 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 71 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 72 | THE SOFTWARE. 73 | 74 | 75 | Generated by CocoaPods - https://cocoapods.org 76 | -------------------------------------------------------------------------------- /Example/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h: -------------------------------------------------------------------------------- 1 | // 2 | // FLAnimatedImage.h 3 | // Flipboard 4 | // 5 | // Created by Raphael Schaad on 7/8/13. 6 | // Copyright (c) 2013-2015 Flipboard. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | // Allow user classes conveniently just importing one header. 13 | #import "FLAnimatedImageView.h" 14 | 15 | 16 | #ifndef NS_DESIGNATED_INITIALIZER 17 | #if __has_attribute(objc_designated_initializer) 18 | #define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer)) 19 | #else 20 | #define NS_DESIGNATED_INITIALIZER 21 | #endif 22 | #endif 23 | 24 | extern const NSTimeInterval kFLAnimatedImageDelayTimeIntervalMinimum; 25 | 26 | // 27 | // An `FLAnimatedImage`'s job is to deliver frames in a highly performant way and works in conjunction with `FLAnimatedImageView`. 28 | // It subclasses `NSObject` and not `UIImage` because it's only an "image" in the sense that a sea lion is a lion. 29 | // It tries to intelligently choose the frame cache size depending on the image and memory situation with the goal to lower CPU usage for smaller ones, lower memory usage for larger ones and always deliver frames for high performant play-back. 30 | // Note: `posterImage`, `size`, `loopCount`, `delayTimes` and `frameCount` don't change after successful initialization. 31 | // 32 | @interface FLAnimatedImage : NSObject 33 | 34 | @property (nonatomic, strong, readonly) UIImage *posterImage; // Guaranteed to be loaded; usually equivalent to `-imageLazilyCachedAtIndex:0` 35 | @property (nonatomic, assign, readonly) CGSize size; // The `.posterImage`'s `.size` 36 | 37 | @property (nonatomic, assign, readonly) NSUInteger loopCount; // 0 means repeating the animation indefinitely 38 | @property (nonatomic, strong, readonly) NSDictionary *delayTimesForIndexes; // Of type `NSTimeInterval` boxed in `NSNumber`s 39 | @property (nonatomic, assign, readonly) NSUInteger frameCount; // Number of valid frames; equal to `[.delayTimes count]` 40 | 41 | @property (nonatomic, assign, readonly) NSUInteger frameCacheSizeCurrent; // Current size of intelligently chosen buffer window; can range in the interval [1..frameCount] 42 | @property (nonatomic, assign) NSUInteger frameCacheSizeMax; // Allow to cap the cache size; 0 means no specific limit (default) 43 | 44 | // Intended to be called from main thread synchronously; will return immediately. 45 | // If the result isn't cached, will return `nil`; the caller should then pause playback, not increment frame counter and keep polling. 46 | // After an initial loading time, depending on `frameCacheSize`, frames should be available immediately from the cache. 47 | - (UIImage *)imageLazilyCachedAtIndex:(NSUInteger)index; 48 | 49 | // Pass either a `UIImage` or an `FLAnimatedImage` and get back its size 50 | + (CGSize)sizeForImage:(id)image; 51 | 52 | // On success, the initializers return an `FLAnimatedImage` with all fields initialized, on failure they return `nil` and an error will be logged. 53 | - (instancetype)initWithAnimatedGIFData:(NSData *)data; 54 | // Pass 0 for optimalFrameCacheSize to get the default, predrawing is enabled by default. 55 | - (instancetype)initWithAnimatedGIFData:(NSData *)data optimalFrameCacheSize:(NSUInteger)optimalFrameCacheSize predrawingEnabled:(BOOL)isPredrawingEnabled NS_DESIGNATED_INITIALIZER; 56 | + (instancetype)animatedImageWithGIFData:(NSData *)data; 57 | 58 | @property (nonatomic, strong, readonly) NSData *data; // The data the receiver was initialized with; read-only 59 | 60 | @end 61 | 62 | typedef NS_ENUM(NSUInteger, FLLogLevel) { 63 | FLLogLevelNone = 0, 64 | FLLogLevelError, 65 | FLLogLevelWarn, 66 | FLLogLevelInfo, 67 | FLLogLevelDebug, 68 | FLLogLevelVerbose 69 | }; 70 | 71 | @interface FLAnimatedImage (Logging) 72 | 73 | + (void)setLogBlock:(void (^)(NSString *logString, FLLogLevel logLevel))logBlock logLevel:(FLLogLevel)logLevel; 74 | + (void)logStringFromBlock:(NSString *(^)(void))stringBlock withLevel:(FLLogLevel)level; 75 | 76 | @end 77 | 78 | #define FLLog(logLevel, format, ...) [FLAnimatedImage logStringFromBlock:^NSString *{ return [NSString stringWithFormat:(format), ## __VA_ARGS__]; } withLevel:(logLevel)] 79 | 80 | @interface FLWeakProxy : NSProxy 81 | 82 | + (instancetype)weakProxyForObject:(id)targetObject; 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser.xcodeproj/xcshareddata/xcschemes/DMLPhotoBrowser-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/DMLPhotoBrowser/Classes/LocalShowViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LocalShowViewController.m 3 | // DMLPhotoBrowserDemo 4 | // 5 | // Created by 戴明亮 on 2017/12/27. 6 | // Copyright © 2017年 戴明亮. All rights reserved. 7 | // 8 | 9 | #import "LocalShowViewController.h" 10 | #import "DMLPhotoBrowser.h" 11 | #import "DMLPhotoItem.h" 12 | #define UISCreenWidth [UIScreen mainScreen].bounds.size.width 13 | #define UISCreenHeight [UIScreen mainScreen].bounds.size.height 14 | @interface LocalShowViewController () 15 | @property (nonatomic, strong) NSArray *images; 16 | @property (nonatomic, strong) UIView *bgview; 17 | @end 18 | 19 | @implementation LocalShowViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | [self configLocalImagesUI]; 25 | 26 | 27 | } 28 | 29 | - (void)configLocalImagesUI 30 | { 31 | 32 | UILabel *la_Tip = [[UILabel alloc] initWithFrame:CGRectMake(0, 64, UISCreenWidth, 60)]; 33 | la_Tip.text = @"相册图片浏览"; 34 | la_Tip.textAlignment = NSTextAlignmentCenter; 35 | la_Tip.font = [UIFont systemFontOfSize:18]; 36 | la_Tip.textColor = [UIColor lightGrayColor]; 37 | [self.view addSubview:la_Tip]; 38 | 39 | UIView *bgview = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(la_Tip.frame), UISCreenWidth, 400)]; 40 | bgview.backgroundColor = [UIColor colorWithRed:245/255.0 green:245/255.0 blue:245/255.0 alpha:245/255.0]; 41 | [self.view addSubview:bgview]; 42 | 43 | 44 | 45 | CGFloat marge_cow = 10; 46 | CGFloat marge_row = 10; 47 | int item = 4; 48 | CGFloat image_Width = (UISCreenWidth - (4 -1)*marge_cow - 2 *marge_cow)/item; 49 | CGFloat image_Height = image_Width; 50 | 51 | 52 | for (int i = 0; i < self.images.count; i ++) { 53 | UIImageView *imageView = [[UIImageView alloc] init]; 54 | imageView.tag = i; 55 | imageView.userInteractionEnabled = YES; 56 | imageView.contentMode = UIViewContentModeScaleAspectFill; 57 | imageView.clipsToBounds = YES; 58 | imageView.image = self.images[i]; 59 | 60 | CGFloat row = i % 4; 61 | CGFloat cow = i / 4; 62 | 63 | CGFloat X = marge_cow + (marge_cow + image_Width)*row; 64 | CGFloat Y = marge_row + (marge_row + image_Height)*cow; 65 | 66 | 67 | imageView.frame = CGRectMake(X, Y, image_Width, image_Height); 68 | 69 | [bgview addSubview:imageView]; 70 | self.bgview = bgview; 71 | 72 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageClick:)]; 73 | [imageView addGestureRecognizer:tapGesture]; 74 | } 75 | 76 | 77 | } 78 | 79 | 80 | 81 | - (void)imageClick:(UIGestureRecognizer *)gesture 82 | { 83 | 84 | UIImageView *imageView =(UIImageView *)gesture.view; 85 | NSLog(@"click %zd Photo",imageView.tag); 86 | 87 | NSMutableArray *photoItems = [NSMutableArray array]; 88 | int i = 0; 89 | for (UIImage *image in self.images) { 90 | 91 | UIImageView *imageViewSource = self.bgview.subviews[i]; 92 | DMLPhotoItem *item = [[DMLPhotoItem alloc] initWithSourceView:imageViewSource image:image]; 93 | [photoItems addObject:item]; 94 | 95 | i ++; 96 | } 97 | 98 | DMLPhotoBrowser *Browser = [[DMLPhotoBrowser alloc] initWithPhotoItems:photoItems selectedIndex:imageView.tag]; 99 | 100 | 101 | [Browser showPhotoBrowser]; 102 | 103 | 104 | } 105 | 106 | 107 | 108 | 109 | -(NSArray *)images{ 110 | 111 | if(_images ==nil){ 112 | NSMutableArray *arrayM = [NSMutableArray array]; 113 | 114 | for (NSUInteger i=0; i<9; i++) { 115 | 116 | UIImage *imagae =[UIImage imageNamed:[NSString stringWithFormat:@"%@",@(i+1)]]; 117 | 118 | [arrayM addObject:imagae]; 119 | } 120 | 121 | _images = arrayM; 122 | } 123 | 124 | return _images; 125 | } 126 | 127 | 128 | /* 129 | #pragma mark - Navigation 130 | 131 | // In a storyboard-based application, you will often want to do a little preparation before navigation 132 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 133 | // Get the new view controller using [segue destinationViewController]. 134 | // Pass the selected object to the new view controller. 135 | } 136 | */ 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 17 | */ 18 | @interface UIImageView (HighlightedWebCache) 19 | 20 | /** 21 | * Set the imageView `highlightedImage` with an `url`. 22 | * 23 | * The download is asynchronous and cached. 24 | * 25 | * @param url The url for the image. 26 | */ 27 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; 28 | 29 | /** 30 | * Set the imageView `highlightedImage` with an `url` and custom options. 31 | * 32 | * The download is asynchronous and cached. 33 | * 34 | * @param url The url for the image. 35 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 36 | */ 37 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 38 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 39 | 40 | /** 41 | * Set the imageView `highlightedImage` with an `url`. 42 | * 43 | * The download is asynchronous and cached. 44 | * 45 | * @param url The url for the image. 46 | * @param completedBlock A block called when operation has been completed. This block has no return value 47 | * and takes the requested UIImage as first parameter. In case of error the image parameter 48 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 49 | * indicating if the image was retrieved from the local cache or from the network. 50 | * The fourth parameter is the original image url. 51 | */ 52 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 53 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 54 | 55 | /** 56 | * Set the imageView `highlightedImage` with an `url` and custom options. 57 | * 58 | * The download is asynchronous and cached. 59 | * 60 | * @param url The url for the image. 61 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 62 | * @param completedBlock A block called when operation has been completed. This block has no return value 63 | * and takes the requested UIImage as first parameter. In case of error the image parameter 64 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 65 | * indicating if the image was retrieved from the local cache or from the network. 66 | * The fourth parameter is the original image url. 67 | */ 68 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 69 | options:(SDWebImageOptions)options 70 | completed:(nullable SDExternalCompletionBlock)completedBlock; 71 | 72 | /** 73 | * Set the imageView `highlightedImage` with an `url` and custom options. 74 | * 75 | * The download is asynchronous and cached. 76 | * 77 | * @param url The url for the image. 78 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 79 | * @param progressBlock A block called while image is downloading 80 | * @note the progress block is executed on a background queue 81 | * @param completedBlock A block called when operation has been completed. This block has no return value 82 | * and takes the requested UIImage as first parameter. In case of error the image parameter 83 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 84 | * indicating if the image was retrieved from the local cache or from the network. 85 | * The fourth parameter is the original image url. 86 | */ 87 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 88 | options:(SDWebImageOptions)options 89 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 90 | completed:(nullable SDExternalCompletionBlock)completedBlock; 91 | 92 | @end 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched (successful or not) 24 | * @param totalCount The total number of images that were to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; 27 | 28 | /** 29 | * Called when all images are prefetched. 30 | * @param imagePrefetcher The current image prefetcher 31 | * @param totalCount The total number of images that were prefetched (whether successful or not) 32 | * @param skippedCount The total number of images that were skipped 33 | */ 34 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; 35 | 36 | @end 37 | 38 | typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); 39 | typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); 40 | 41 | /** 42 | * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. 43 | */ 44 | @interface SDWebImagePrefetcher : NSObject 45 | 46 | /** 47 | * The web image manager 48 | */ 49 | @property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; 50 | 51 | /** 52 | * Maximum number of URLs to prefetch at the same time. Defaults to 3. 53 | */ 54 | @property (nonatomic, assign) NSUInteger maxConcurrentDownloads; 55 | 56 | /** 57 | * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. 58 | */ 59 | @property (nonatomic, assign) SDWebImageOptions options; 60 | 61 | /** 62 | * Queue options for Prefetcher. Defaults to Main Queue. 63 | */ 64 | @property (SDDispatchQueueSetterSementics, nonatomic, nonnull) dispatch_queue_t prefetcherQueue; 65 | 66 | @property (weak, nonatomic, nullable) id delegate; 67 | 68 | /** 69 | * Return the global image prefetcher instance. 70 | */ 71 | + (nonnull instancetype)sharedImagePrefetcher; 72 | 73 | /** 74 | * Allows you to instantiate a prefetcher with any arbitrary image manager. 75 | */ 76 | - (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; 77 | 78 | /** 79 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 80 | * currently one image is downloaded at a time, 81 | * and skips images for failed downloads and proceed to the next image in the list. 82 | * Any previously-running prefetch operations are canceled. 83 | * 84 | * @param urls list of URLs to prefetch 85 | */ 86 | - (void)prefetchURLs:(nullable NSArray *)urls; 87 | 88 | /** 89 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 90 | * currently one image is downloaded at a time, 91 | * and skips images for failed downloads and proceed to the next image in the list. 92 | * Any previously-running prefetch operations are canceled. 93 | * 94 | * @param urls list of URLs to prefetch 95 | * @param progressBlock block to be called when progress updates; 96 | * first parameter is the number of completed (successful or not) requests, 97 | * second parameter is the total number of images originally requested to be prefetched 98 | * @param completionBlock block to be called when prefetching is completed 99 | * first param is the number of completed (successful or not) requests, 100 | * second parameter is the number of skipped requests 101 | */ 102 | - (void)prefetchURLs:(nullable NSArray *)urls 103 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 104 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; 105 | 106 | /** 107 | * Remove and cancel queued list 108 | */ 109 | - (void)cancelPrefetching; 110 | 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 10 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 11 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 12 | 13 | install_framework() 14 | { 15 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 16 | local source="${BUILT_PRODUCTS_DIR}/$1" 17 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 18 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 19 | elif [ -r "$1" ]; then 20 | local source="$1" 21 | fi 22 | 23 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 24 | 25 | if [ -L "${source}" ]; then 26 | echo "Symlinked..." 27 | source="$(readlink "${source}")" 28 | fi 29 | 30 | # Use filter instead of exclude so missing patterns don't throw errors. 31 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 32 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 33 | 34 | local basename 35 | basename="$(basename -s .framework "$1")" 36 | binary="${destination}/${basename}.framework/${basename}" 37 | if ! [ -r "$binary" ]; then 38 | binary="${destination}/${basename}" 39 | fi 40 | 41 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 42 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 43 | strip_invalid_archs "$binary" 44 | fi 45 | 46 | # Resign the code if required by the build settings to avoid unstable apps 47 | code_sign_if_enabled "${destination}/$(basename "$1")" 48 | 49 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 50 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 51 | local swift_runtime_libs 52 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 53 | for lib in $swift_runtime_libs; do 54 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 55 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 56 | code_sign_if_enabled "${destination}/${lib}" 57 | done 58 | fi 59 | } 60 | 61 | # Copies the dSYM of a vendored framework 62 | install_dsym() { 63 | local source="$1" 64 | if [ -r "$source" ]; then 65 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\"" 66 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}" 67 | fi 68 | } 69 | 70 | # Signs a framework with the provided identity 71 | code_sign_if_enabled() { 72 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 73 | # Use the current code_sign_identitiy 74 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 75 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 76 | 77 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 78 | code_sign_cmd="$code_sign_cmd &" 79 | fi 80 | echo "$code_sign_cmd" 81 | eval "$code_sign_cmd" 82 | fi 83 | } 84 | 85 | # Strip invalid architectures 86 | strip_invalid_archs() { 87 | binary="$1" 88 | # Get architectures for current file 89 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 90 | stripped="" 91 | for arch in $archs; do 92 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 93 | # Strip non-valid architectures in-place 94 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 95 | stripped="$stripped $arch" 96 | fi 97 | done 98 | if [[ "$stripped" ]]; then 99 | echo "Stripped $binary of architectures:$stripped" 100 | fi 101 | } 102 | 103 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 104 | wait 105 | fi 106 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/M80AttributedLabel/M80AttributedLabelAttachment.m: -------------------------------------------------------------------------------- 1 | // 2 | // M80AttributedLabelAttachment.m 3 | // M80AttributedLabel 4 | // 5 | // Created by amao on 13-8-31. 6 | // Copyright (c) 2013年 www.xiangwangfeng.com. All rights reserved. 7 | // 8 | 9 | #import "M80AttributedLabelAttachment.h" 10 | 11 | void deallocCallback(void* ref) 12 | { 13 | 14 | } 15 | 16 | CGFloat ascentCallback(void *ref) 17 | { 18 | M80AttributedLabelAttachment *image = (__bridge M80AttributedLabelAttachment *)ref; 19 | CGFloat ascent = 0; 20 | CGFloat height = [image boxSize].height; 21 | switch (image.alignment) 22 | { 23 | case M80ImageAlignmentTop: 24 | ascent = image.fontAscent; 25 | break; 26 | case M80ImageAlignmentCenter: 27 | { 28 | CGFloat fontAscent = image.fontAscent; 29 | CGFloat fontDescent = image.fontDescent; 30 | CGFloat baseLine = (fontAscent + fontDescent) / 2 - fontDescent; 31 | ascent = height / 2 + baseLine; 32 | } 33 | break; 34 | case M80ImageAlignmentBottom: 35 | ascent = height - image.fontDescent; 36 | break; 37 | default: 38 | break; 39 | } 40 | return ascent; 41 | } 42 | 43 | CGFloat descentCallback(void *ref) 44 | { 45 | M80AttributedLabelAttachment *image = (__bridge M80AttributedLabelAttachment *)ref; 46 | CGFloat descent = 0; 47 | CGFloat height = [image boxSize].height; 48 | switch (image.alignment) 49 | { 50 | case M80ImageAlignmentTop: 51 | { 52 | descent = height - image.fontAscent; 53 | break; 54 | } 55 | case M80ImageAlignmentCenter: 56 | { 57 | CGFloat fontAscent = image.fontAscent; 58 | CGFloat fontDescent = image.fontDescent; 59 | CGFloat baseLine = (fontAscent + fontDescent) / 2 - fontDescent; 60 | descent = height / 2 - baseLine; 61 | } 62 | break; 63 | case M80ImageAlignmentBottom: 64 | { 65 | descent = image.fontDescent; 66 | break; 67 | } 68 | default: 69 | break; 70 | } 71 | 72 | return descent; 73 | 74 | } 75 | 76 | CGFloat widthCallback(void* ref) 77 | { 78 | M80AttributedLabelAttachment *image = (__bridge M80AttributedLabelAttachment *)ref; 79 | return [image boxSize].width; 80 | } 81 | 82 | #pragma mark - M80AttributedLabelImage 83 | @interface M80AttributedLabelAttachment () 84 | - (CGSize)calculateContentSize; 85 | - (CGSize)attachmentSize; 86 | @end 87 | 88 | @implementation M80AttributedLabelAttachment 89 | 90 | 91 | 92 | 93 | + (M80AttributedLabelAttachment *)attachmentWith:(id)content 94 | margin:(UIEdgeInsets)margin 95 | alignment:(M80ImageAlignment)alignment 96 | maxSize:(CGSize)maxSize 97 | { 98 | M80AttributedLabelAttachment *attachment = [[M80AttributedLabelAttachment alloc]init]; 99 | attachment.content = content; 100 | attachment.margin = margin; 101 | attachment.alignment = alignment; 102 | attachment.maxSize = maxSize; 103 | return attachment; 104 | } 105 | 106 | 107 | - (CGSize)boxSize 108 | { 109 | CGSize contentSize = [self attachmentSize]; 110 | if (_maxSize.width > 0 &&_maxSize.height > 0 && 111 | contentSize.width > 0 && contentSize.height > 0) 112 | { 113 | contentSize = [self calculateContentSize]; 114 | } 115 | return CGSizeMake(contentSize.width + _margin.left + _margin.right, 116 | contentSize.height+ _margin.top + _margin.bottom); 117 | } 118 | 119 | 120 | #pragma mark - 辅助方法 121 | - (CGSize)calculateContentSize 122 | { 123 | CGSize attachmentSize = [self attachmentSize]; 124 | CGFloat width = attachmentSize.width; 125 | CGFloat height = attachmentSize.height; 126 | CGFloat newWidth = _maxSize.width; 127 | CGFloat newHeight = _maxSize.height; 128 | if (width <= newWidth && 129 | height<= newHeight) 130 | { 131 | return attachmentSize; 132 | } 133 | CGSize size; 134 | if (width / height > newWidth / newHeight) 135 | { 136 | size = CGSizeMake(newWidth, newWidth * height / width); 137 | } 138 | else 139 | { 140 | size = CGSizeMake(newHeight * width / height, newHeight); 141 | } 142 | return size; 143 | } 144 | 145 | - (CGSize)attachmentSize 146 | { 147 | CGSize size = CGSizeZero; 148 | if ([_content isKindOfClass:[UIImage class]]) 149 | { 150 | size = [((UIImage *)_content) size]; 151 | } 152 | else if ([_content isKindOfClass:[UIView class]]) 153 | { 154 | size = [((UIView *)_content) bounds].size; 155 | } 156 | return size; 157 | } 158 | @end 159 | -------------------------------------------------------------------------------- /Example/Pods/FLAnimatedImage/README.md: -------------------------------------------------------------------------------- 1 | FLAnimatedImage is a performant animated GIF engine for iOS: 2 | 3 | - Plays multiple GIFs simultaneously with a playback speed comparable to desktop browsers 4 | - Honors variable frame delays 5 | - Behaves gracefully under memory pressure 6 | - Eliminates delays or blocking during the first playback loop 7 | - Interprets the frame delays of fast GIFs the same way modern browsers do 8 | 9 | It's a well-tested [component that powers all GIFs in Flipboard](http://engineering.flipboard.com/2014/05/animated-gif/). To understand its behavior it comes with an interactive demo: 10 | 11 | ![Flipboard playing multiple GIFs](https://github.com/Flipboard/FLAnimatedImage/raw/master/images/flanimatedimage-demo-player.gif) 12 | 13 | ## Who is this for? 14 | 15 | - Apps that don't support animated GIFs yet 16 | - Apps that already support animated GIFs but want a higher performance solution 17 | - People who want to tinker with the code ([the corresponding blog post](http://engineering.flipboard.com/2014/05/animated-gif/) is a great place to start; also see the *To Do* section below) 18 | 19 | ## Installation & Usage 20 | 21 | FLAnimatedImage is a well encapsulated drop-in component. Simply replace your `UIImageView` instances with instances of `FLAnimatedImageView` to get animated GIF support. There is no central cache or state to manage. 22 | 23 | If using CocoaPods, the quickest way to try it out is to type this on the command line: 24 | 25 | ```shell 26 | $ pod try FLAnimatedImage 27 | ``` 28 | 29 | To add it to your app, copy the two classes `FLAnimatedImage.h/.m` and `FLAnimatedImageView.h/.m` into your Xcode project or add via [CocoaPods](http://cocoapods.org) by adding this to your Podfile: 30 | 31 | ```ruby 32 | pod 'FLAnimatedImage', '~> 1.0' 33 | ``` 34 | 35 | If using [Carthage](https://github.com/Carthage/Carthage), add following line into your `Cartfile` 36 | 37 | ``` 38 | github "Flipboard/FLAnimatedImage" 39 | ``` 40 | 41 | In your code, `#import "FLAnimatedImage.h"`, create an image from an animated GIF, and setup the image view to display it: 42 | 43 | ```objective-c 44 | FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif"]]]; 45 | FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init]; 46 | imageView.animatedImage = image; 47 | imageView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); 48 | [self.view addSubview:imageView]; 49 | ``` 50 | 51 | It's flexible to integrate in your custom image loading stack and backwards compatible to iOS 6. 52 | 53 | It uses ARC and the Apple frameworks `QuartzCore`, `ImageIO`, `MobileCoreServices`, and `CoreGraphics`. 54 | 55 | It is capable of fine-grained logging. A block can be set on `FLAnimatedImage` that's invoked when logging occurs with various log levels via the `+setLogBlock:logLevel:` method. For example: 56 | 57 | ```objective-c 58 | // Set up FLAnimatedImage logging. 59 | [FLAnimatedImage setLogBlock:^(NSString *logString, FLLogLevel logLevel) { 60 | // Using NSLog 61 | NSLog(@"%@", logString); 62 | 63 | // ...or CocoaLumberjackLogger only logging warnings and errors 64 | if (logLevel == FLLogLevelError) { 65 | DDLogError(@"%@", logString); 66 | } else if (logLevel == FLLogLevelWarn) { 67 | DDLogWarn(@"%@", logString); 68 | } 69 | } logLevel:FLLogLevelWarn]; 70 | ``` 71 | 72 | Since FLAnimatedImage is licensed under MIT, it's compatible with the terms of using it for any app on the App Store. 73 | 74 | ## To Do 75 | - Support other animated image formats such as APNG or WebP (WebP support implemented [here](https://github.com/Flipboard/FLAnimatedImage/pull/86)) 76 | - Integration into network libraries and image caches 77 | - Investigate whether `FLAnimatedImage` should become a `UIImage` subclass 78 | - Smarter buffering 79 | - Bring demo app to iPhone 80 | 81 | This has successfully shipped to many people as is, but please do come with your questions, issues and pull requests! 82 | 83 | ## Select apps using FLAnimatedImage 84 | - [Dropbox](https://www.dropbox.com) 85 | - [Medium](https://medium.com) 86 | - [Facebook](https://facebook.com) 87 | - [Pinterest](https://pinterest.com) 88 | - [LiveBooth](http://www.liveboothapp.com) 89 | - [Design Shots](https://itunes.apple.com/app/id792517951) 90 | - [lWlVl Festival](http://lwlvl.com) 91 | - [Close-up](http://closeu.pe) 92 | - [Zip Code Finder](https://itunes.apple.com/app/id893031254) 93 | - [getGIF](https://itunes.apple.com/app/id964784701) 94 | - [Giffage](http://giffage.com) 95 | - [Flipboard](https://flipboard.com) 96 | - [Gifalicious](https://itunes.apple.com/us/app/gifalicious-see-your-gifs/id965346708?mt=8) 97 | - [Slack](https://slack.com/) 98 | - [Telegram](https://telegram.org/) 99 | - [HashPhotos](https://itunes.apple.com/app/id685784609) 100 | - [Ello](https://ello.co/) 101 | - [Dumpert](http://dumpert.nl) 102 | 103 | If you're using FLAnimatedImage in your app please open a PR to add it to this list! 104 | -------------------------------------------------------------------------------- /Example/Pods/M80AttributedLabel/README.md: -------------------------------------------------------------------------------- 1 | M80AttributedLabel 2 | ================== 3 | 4 | 5 | Another attributed label using CoreText [中文版本](./Documents/README.md) 6 | 7 | 8 | # Features 9 | * Multi-line Rich Text Display 10 | * Auto Link Detection and Custom Links Supported 11 | * Embedding Image and Custom Views 12 | * Following Properties Supported: 13 | * `font` 14 | * `textColor` 15 | * `highlightColor` 16 | * `linkColor` 17 | * `underLineForLink` 18 | * `numbersOfLines` (Truncates Last Line Supported) 19 | * `textAlignment` 20 | * `lineBreakMode` 21 | * `lineSpacing` 22 | * `paragraphSpacing` 23 | * `shadowColor` 24 | * `shadowOffset` 25 | * `shadowBlur` 26 | 27 | 28 | 29 | # System Requirement 30 | * iOS 7.0 or later 31 | * ARC required 32 | 33 | # Installation 34 | ### Podfile 35 | ```ruby 36 | pod 'M80AttributedLabel' 37 | ``` 38 | ### Manually 39 | * `git clone https://github.com/xiangwangfeng/M80AttributedLabel.git` 40 | * Copy files in `Class/M80AttributedLabel` to your project 41 | * Add `CoreText.framework` to your target 42 | 43 | # Usage 44 | 45 | ## Basic 46 | 47 | ```objc 48 | 49 | M80AttributedLabel *label = [[M80AttributedLabel alloc]initWithFrame:CGRectZero]; 50 | 51 | label.text = @"Hello M80AttributedLabel"; 52 | label.font = [UIFont fontWithName:@"Zapfino" size:25]; 53 | label.textColor = M80RGB(0xFF9F00); 54 | label.shadowColor = [UIColor grayColor]; 55 | label.shadowOffset= CGSizeMake(1, 1); 56 | label.shadowBlur = 1; 57 | 58 | label.frame = CGRectInset(self.view.bounds,20,20); 59 | 60 | [self.view addSubview:label]; 61 | 62 | ``` 63 | 64 | 65 | 66 | ## Link 67 | 68 | ```objc 69 | 70 | M80AttributedLabel *label = [[M80AttributedLabel alloc]initWithFrame:CGRectZero]; 71 | 72 | NSString *text = @"The game which I current play is hearthstone,and its website is www.hearthstone.com.cn"; 73 | NSRange range = [text rangeOfString:@"hearthstone"]; 74 | label.text = text; 75 | [label addCustomLink:[NSValue valueWithRange:range] 76 | forRange:range]; 77 | label.delegate = self; 78 | 79 | label.frame = CGRectInset(self.view.bounds,20,20); 80 | 81 | [self.view addSubview:label]; 82 | 83 | 84 | ``` 85 | 86 | 87 | 88 | 89 | ## Image 90 | 91 | ```objc 92 | 93 | 94 | M80AttributedLabel *label = [[M80AttributedLabel alloc]initWithFrame:CGRectZero]; 95 | label.lineSpacing = 5.0; 96 | 97 | [label appendImage:[UIImage imageNamed:@"avatar"] 98 | maxSize:CGSizeMake(40, 40) 99 | margin:UIEdgeInsetsZero 100 | alignment:M80ImageAlignmentBottom]; 101 | 102 | NSString *text = @"say:\n有人问一位登山家为什么要去登山——谁都知道登山这件事既危险,又没什么实际的好处。[haha][haha][haha][haha]他回答道:“因为那座山峰在那里。”我喜欢这个答案,因为里面包含着幽默感——明明是自己想要登山,偏说是山在那里使他心里痒痒。除此之外,我还喜欢这位登山家干的事,没来由地往悬崖上爬。[haha][haha][haha]它会导致肌肉疼痛,还要冒摔出脑子的危险,所以一般人尽量避免爬山。[haha][haha][haha]用热力学的角度来看,这是个反熵的现象,所发趋害避利肯定反熵。"; 103 | 104 | //replace [haha] by image 105 | NSArray *components = [text componentsSeparatedByString:@"[haha]"]; 106 | NSUInteger count = [components count]; 107 | for (NSUInteger i = 0; i < count; i++) 108 | { 109 | [label appendText:[components objectAtIndex:i]]; 110 | if (i != count - 1) 111 | { 112 | [label appendImage:[UIImage imageNamed:@"haha"] 113 | maxSize:CGSizeMake(15, 15) 114 | margin:UIEdgeInsetsZero 115 | alignment:M80ImageAlignmentCenter]; 116 | } 117 | } 118 | 119 | label.frame = CGRectInset(self.view.bounds,20,20); 120 | [self.view addSubview:label]; 121 | 122 | 123 | ``` 124 | 125 | 126 | 127 | ## Attachemnt 128 | 129 | ```objc 130 | 131 | M80AttributedLabel *label = [[M80AttributedLabel alloc]initWithFrame:CGRectZero]; 132 | 133 | for (NSInteger i = 0; i < 3; i++) 134 | { 135 | [label appendText:@"Click the icon to fire event"]; 136 | 137 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 138 | button setBackgroundImage:[UIImage imageNamed:@"play"] forState:UIControlStateNormal]; 139 | [button addTarget:self 140 | action:@selector(buttonClicked:) 141 | forControlEvents:UIControlEventTouchUpInside]; 142 | [button setBounds:CGRectMake(0, 0, 30, 30)]; 143 | [button setTag:i]; 144 | [label appendView:button]; 145 | 146 | [label appendText:@"\n\n\n"]; 147 | } 148 | 149 | 150 | label.frame = CGRectInset(self.view.bounds,20,20); 151 | [self.view addSubview:label]; 152 | 153 | ``` 154 | 155 | 156 | 157 | # Contact 158 | * https://github.com/xiangwangfeng 159 | * http://www.xiangwangfeng.com 160 | * xiangwangfeng@gmail.com 161 | * http://weibo.com/epmao 162 | 163 | [Apache]: http://www.apache.org/licenses/LICENSE-2.0 164 | [MIT]: http://www.opensource.org/licenses/mit-license.php 165 | [GPL]: http://www.gnu.org/licenses/gpl.html 166 | [BSD]: http://opensource.org/licenses/bsd-license.php 167 | 168 | # License 169 | 170 | M80AttributedLabel is available under the [MIT license][MIT]. See the LICENSE file for more info. 171 | -------------------------------------------------------------------------------- /Example/Pods/NIMKit/README.md: -------------------------------------------------------------------------------- 1 | # 网易云信 UI 组件 · iOS 2 | [![Build Status](https://img.shields.io/travis/netease-im/NIM_iOS_UIKit/master.svg?style=flat)](https://travis-ci.org/netease-im/NIM_iOS_UIKit) 3 | [![Pod Version](https://img.shields.io/cocoapods/v/NIMKit.svg?style=flat)](#) 4 | [![Pod Platform](http://img.shields.io/cocoapods/p/NIMKit.svg?style=flat)](#) 5 | [![Minimum Requirement](http://img.shields.io/badge/Requirement-iOS%208.0%2B-green.svg?style=flat)](#) 6 | [![LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](./LICENSE) 7 | 8 | ## 简介 9 | 10 | 云信 UI 组件,全称 `Netease Instant Message Kit`,简称 `NIMKit`,是一款开源的聊天组件,并支持二次开发。开发者只需要稍作配置就可以打造出属于自己的聊天界面,而通过一些自定义的设置,也可以轻松添加业务相关的功能,如阅后即焚,红包,点赞等功能。NIMKit 底层依赖 `NIMSDK`,是一款由网易开发的 IM SDK,通过它可以轻松快速在你的 App 中集成 IM 功能。 11 | 12 | ## 源起 13 | 14 | 在一个开发首次做 IM App 时,聊天界面的 ViewController 几乎会变成项目开发中的泥潭,随着项目推进和需求迭代,聊天界面 ViewController 往往会变成 Massive View Controller,所有聊天界面相关的代码都堆积在一起,整个 ViewController 的代码轻松就上千行,无法很好的解耦。 15 | 16 | 造成聊天界面代码臃肿的原因往往有: 17 | 18 | * 消息种类繁多,没有做很好的归类与统一,代码可拓展性低 19 | * 聊天界面 UI 元素,事件,回调众多,没有合理解耦 20 | 21 | 而在日常的 iOS 开发中,大牛们为我们总结出各种方法来进行各个模块的解耦,大方向上有 22 | 23 | * MVCS 24 | * MVP 25 | * MVVM 26 | * VIPER 27 | 28 | 落实到细节上,又有使用组合,抽取数据源等等小技巧。但对于一些经验不足的 iOS 开发而言,做出一个优雅的聊天界面 ViewController 仍旧是一件难于上青天的事。 29 | 30 | 在开发云信的前期,我们虽然也意识到这方面的困难,在提供云信 SDK 的同时也开源了相应的 Demo 源码,意在提供一个比较优雅的实现参考,但对于接入的开发者而言,成本仍然过大。这也是这个组件库的由来和目的:开发者在不写任何一行代码的情况下也能够轻松实现一个聊天界面。 31 | 32 | 33 | ## 集成环境 34 | * 编译版本 : iOS SDK 10.0 及以上。 35 | * 操作系统 : iOS 8.0 及以上。 36 | 37 | ## 集成说明 38 | 39 | ### Cocoapods 集成 40 | 41 | 我们建议你通过 [Cocoapods](https://cocoapods.org/) 来进行 `NIMKit` 的集成,在 `Podfile` 中加入以下内容: 42 | 43 | ```shell 44 | pod 'NIMKit' 45 | ``` 46 | 47 | 需要注意的是默认 `NIMKit` 依赖于 [轻量版本](https://github.com/netease-im/NIM_iOS_SDK_Lite) 的 `NIMSDK`,而 [完整版本](https://github.com/netease-im/NIM_iOS_SDK) 的 `NIMSDK` 不仅有 IM 模块,也有音视频模块。对于很多产品而言,只需要接入单纯的 IM 模块,这样可以减少对不必要模块的依赖,进而减少 App 体积。所以我们有两个版本的组件可供选择,安装完组件之后,则不必再安装 `NIMSDK` 依赖。 48 | 49 | * 轻量版本 50 | 51 | ```shell 52 | pod 'NIMKit' 53 | ``` 54 | 55 | 或 56 | 57 | ```shell 58 | pod 'NIMKit/Lite' 59 | ``` 60 | 61 | * 完整版本 62 | 63 | ```shell 64 | pod 'NIMKit/Full' 65 | ``` 66 | 67 | ### Swift 集成 68 | 69 | 由于使用 Swift 开发的第三方库不支持编译为静态库,`NIMKit` 和这些库同时使用 [Cocoapods](https://cocoapods.org/) 的时候会出现一些问题,具体解决方案可以参考这个[文档](./Documents/nim_swift.md)。 70 | 71 | 72 | ### 手动集成 73 | 74 | 我们`强烈`不推荐你使用手动导入的方式来集成 `NIMKit`,但如果你一定要这么做,可以参考这个[文档](./Documents/nim_mi.md)。 75 | 76 | 77 | 78 | ## 快速使用 79 | 80 | `NIMKit` 提供两个最重要的类 81 | 82 | * `NIMSessionViewController` 83 | * `NIMSessionListViewController` 84 | 85 | 前者用于会话界面的显示和互动,而后者提供了最近会话功能。在集成 `NIMSDK` 且完成了基础设置后,直接调用这两个类就可以得到完善的聊天界面和会话列表。 86 | 87 | ### 聊天界面 88 | 89 | 初始化聊天界面时,上层需要传入当前聊天界面对应的会话信息,即 `NIMSession` 90 | 91 | ```objc 92 | NIMSession *session = [NIMSession session:uid type:NIMSessionTypeP2P]; 93 | NIMSessionViewController *vc = [[NIMSessionViewController alloc] initWithSession:session]; 94 | [self.navigationController pushViewController:vc animated:YES]; 95 | ``` 96 | 97 | ### 会话列表 98 | 99 | 初始化会话列表不需要任何前置条件,直接初始化即可。 100 | 101 | ```objc 102 | NIMSessionListViewController *vc = [[NIMSessionListViewController alloc] init]; 103 | ``` 104 | 105 | ## 集成效果 106 | 107 | 108 | | 最近会话进入会话 | 群组会话 | 发送多张图片 | 109 | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | 110 | | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_1.gif) | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_2.gif) | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_3.gif) | 111 | 112 | | 发送语音 | 发送地理位置 | 发送中与发送失败,点击叹号可重发 | 113 | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | 114 | | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_4.gif) | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_5.gif) | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_6.gif) | 115 | 116 | | 自定义消息-阅后即焚示例 | 最近联系人选择器 | 最近会话删除与未读删除 | 117 | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | 118 | | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_7.gif) | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_8.gif) | ![image](https://github.com/netease-im/NIM_Resources/blob/master/iOS/Images/nimkit_9.gif) | 119 | 120 | 121 | ## 定制化 122 | 123 | 在不做任何修改,直接套用 `NIMKit` 组件,就能够达到上述效果。但不同的产品往往会有不同的定制化需求,定制化需求参考 124 | 125 | 1.[《项目结构介绍》](./Documents/nim_arch.md) 126 | 127 | 2.[《界面排版自定义》](./Documents/nim_custom_ui.md) 128 | 129 | 3.[《新消息类型集成》](./Documents/nim_custom_message.md) 130 | 131 | 4.[《用户信息自定义》](./Documents/nim_userinfo.md) 132 | 133 | 5.[《机器人消息排版指南》](./Documents/nim_robot.md) 134 | 135 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageDownloader.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStartNotification; 14 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadReceiveResponseNotification; 15 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification; 16 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadFinishNotification; 17 | 18 | 19 | 20 | /** 21 | Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol 22 | */ 23 | @protocol SDWebImageDownloaderOperationInterface 24 | 25 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 26 | inSession:(nullable NSURLSession *)session 27 | options:(SDWebImageDownloaderOptions)options; 28 | 29 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 30 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 31 | 32 | - (BOOL)shouldDecompressImages; 33 | - (void)setShouldDecompressImages:(BOOL)value; 34 | 35 | - (nullable NSURLCredential *)credential; 36 | - (void)setCredential:(nullable NSURLCredential *)value; 37 | 38 | @end 39 | 40 | 41 | @interface SDWebImageDownloaderOperation : NSOperation 42 | 43 | /** 44 | * The request used by the operation's task. 45 | */ 46 | @property (strong, nonatomic, readonly, nullable) NSURLRequest *request; 47 | 48 | /** 49 | * The operation's task 50 | */ 51 | @property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; 52 | 53 | 54 | @property (assign, nonatomic) BOOL shouldDecompressImages; 55 | 56 | /** 57 | * Was used to determine whether the URL connection should consult the credential storage for authenticating the connection. 58 | * @deprecated Not used for a couple of versions 59 | */ 60 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility"); 61 | 62 | /** 63 | * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. 64 | * 65 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 66 | */ 67 | @property (nonatomic, strong, nullable) NSURLCredential *credential; 68 | 69 | /** 70 | * The SDWebImageDownloaderOptions for the receiver. 71 | */ 72 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 73 | 74 | /** 75 | * The expected size of data. 76 | */ 77 | @property (assign, nonatomic) NSInteger expectedSize; 78 | 79 | /** 80 | * The response returned by the operation's connection. 81 | */ 82 | @property (strong, nonatomic, nullable) NSURLResponse *response; 83 | 84 | /** 85 | * Initializes a `SDWebImageDownloaderOperation` object 86 | * 87 | * @see SDWebImageDownloaderOperation 88 | * 89 | * @param request the URL request 90 | * @param session the URL session in which this operation will run 91 | * @param options downloader options 92 | * 93 | * @return the initialized instance 94 | */ 95 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 96 | inSession:(nullable NSURLSession *)session 97 | options:(SDWebImageDownloaderOptions)options NS_DESIGNATED_INITIALIZER; 98 | 99 | /** 100 | * Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of 101 | * callbacks. 102 | * 103 | * @param progressBlock the block executed when a new chunk of data arrives. 104 | * @note the progress block is executed on a background queue 105 | * @param completedBlock the block executed when the download is done. 106 | * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue 107 | * 108 | * @return the token to use to cancel this set of handlers 109 | */ 110 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 111 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 112 | 113 | /** 114 | * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. 115 | * 116 | * @param token the token representing a set of callbacks to cancel 117 | * 118 | * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. 119 | */ 120 | - (BOOL)cancel:(nullable id)token; 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2018 MrDML <dml1630@163.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | DMLPhotoBrowser 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | The MIT License (MIT) 47 | 48 | Copyright (c) 2014-2016 Flipboard 49 | 50 | Permission is hereby granted, free of charge, to any person obtaining a copy 51 | of this software and associated documentation files (the "Software"), to deal 52 | in the Software without restriction, including without limitation the rights 53 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 54 | copies of the Software, and to permit persons to whom the Software is 55 | furnished to do so, subject to the following conditions: 56 | 57 | The above copyright notice and this permission notice shall be included in all 58 | copies or substantial portions of the Software. 59 | 60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 61 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 62 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 63 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 64 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 65 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 66 | SOFTWARE. 67 | 68 | License 69 | MIT 70 | Title 71 | FLAnimatedImage 72 | Type 73 | PSGroupSpecifier 74 | 75 | 76 | FooterText 77 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 78 | 79 | Permission is hereby granted, free of charge, to any person obtaining a copy 80 | of this software and associated documentation files (the "Software"), to deal 81 | in the Software without restriction, including without limitation the rights 82 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 83 | copies of the Software, and to permit persons to whom the Software is furnished 84 | to do so, subject to the following conditions: 85 | 86 | The above copyright notice and this permission notice shall be included in all 87 | copies or substantial portions of the Software. 88 | 89 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 90 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 91 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 92 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 93 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 94 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 95 | THE SOFTWARE. 96 | 97 | 98 | License 99 | MIT 100 | Title 101 | SDWebImage 102 | Type 103 | PSGroupSpecifier 104 | 105 | 106 | FooterText 107 | Generated by CocoaPods - https://cocoapods.org 108 | Title 109 | 110 | Type 111 | PSGroupSpecifier 112 | 113 | 114 | StringsTable 115 | Acknowledgements 116 | Title 117 | Acknowledgements 118 | 119 | 120 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImagePrefetcher.h" 10 | 11 | @interface SDWebImagePrefetcher () 12 | 13 | @property (strong, nonatomic, nonnull) SDWebImageManager *manager; 14 | @property (strong, nonatomic, nullable) NSArray *prefetchURLs; 15 | @property (assign, nonatomic) NSUInteger requestedCount; 16 | @property (assign, nonatomic) NSUInteger skippedCount; 17 | @property (assign, nonatomic) NSUInteger finishedCount; 18 | @property (assign, nonatomic) NSTimeInterval startedTime; 19 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; 20 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherProgressBlock progressBlock; 21 | 22 | @end 23 | 24 | @implementation SDWebImagePrefetcher 25 | 26 | + (nonnull instancetype)sharedImagePrefetcher { 27 | static dispatch_once_t once; 28 | static id instance; 29 | dispatch_once(&once, ^{ 30 | instance = [self new]; 31 | }); 32 | return instance; 33 | } 34 | 35 | - (nonnull instancetype)init { 36 | return [self initWithImageManager:[SDWebImageManager new]]; 37 | } 38 | 39 | - (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { 40 | if ((self = [super init])) { 41 | _manager = manager; 42 | _options = SDWebImageLowPriority; 43 | _prefetcherQueue = dispatch_get_main_queue(); 44 | self.maxConcurrentDownloads = 3; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { 50 | self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; 51 | } 52 | 53 | - (NSUInteger)maxConcurrentDownloads { 54 | return self.manager.imageDownloader.maxConcurrentDownloads; 55 | } 56 | 57 | - (void)startPrefetchingAtIndex:(NSUInteger)index { 58 | if (index >= self.prefetchURLs.count) return; 59 | self.requestedCount++; 60 | [self.manager loadImageWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 61 | if (!finished) return; 62 | self.finishedCount++; 63 | 64 | if (image) { 65 | if (self.progressBlock) { 66 | self.progressBlock(self.finishedCount,(self.prefetchURLs).count); 67 | } 68 | } 69 | else { 70 | if (self.progressBlock) { 71 | self.progressBlock(self.finishedCount,(self.prefetchURLs).count); 72 | } 73 | // Add last failed 74 | self.skippedCount++; 75 | } 76 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 77 | [self.delegate imagePrefetcher:self 78 | didPrefetchURL:self.prefetchURLs[index] 79 | finishedCount:self.finishedCount 80 | totalCount:self.prefetchURLs.count 81 | ]; 82 | } 83 | if (self.prefetchURLs.count > self.requestedCount) { 84 | dispatch_async(self.prefetcherQueue, ^{ 85 | [self startPrefetchingAtIndex:self.requestedCount]; 86 | }); 87 | } else if (self.finishedCount == self.requestedCount) { 88 | [self reportStatus]; 89 | if (self.completionBlock) { 90 | self.completionBlock(self.finishedCount, self.skippedCount); 91 | self.completionBlock = nil; 92 | } 93 | self.progressBlock = nil; 94 | } 95 | }]; 96 | } 97 | 98 | - (void)reportStatus { 99 | NSUInteger total = (self.prefetchURLs).count; 100 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 101 | [self.delegate imagePrefetcher:self 102 | didFinishWithTotalCount:(total - self.skippedCount) 103 | skippedCount:self.skippedCount 104 | ]; 105 | } 106 | } 107 | 108 | - (void)prefetchURLs:(nullable NSArray *)urls { 109 | [self prefetchURLs:urls progress:nil completed:nil]; 110 | } 111 | 112 | - (void)prefetchURLs:(nullable NSArray *)urls 113 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 114 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { 115 | [self cancelPrefetching]; // Prevent duplicate prefetch request 116 | self.startedTime = CFAbsoluteTimeGetCurrent(); 117 | self.prefetchURLs = urls; 118 | self.completionBlock = completionBlock; 119 | self.progressBlock = progressBlock; 120 | 121 | if (urls.count == 0) { 122 | if (completionBlock) { 123 | completionBlock(0,0); 124 | } 125 | } else { 126 | // Starts prefetching from the very first image on the list with the max allowed concurrency 127 | NSUInteger listCount = self.prefetchURLs.count; 128 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 129 | [self startPrefetchingAtIndex:i]; 130 | } 131 | } 132 | } 133 | 134 | - (void)cancelPrefetching { 135 | self.prefetchURLs = nil; 136 | self.skippedCount = 0; 137 | self.requestedCount = 0; 138 | self.finishedCount = 0; 139 | [self.manager cancelAll]; 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImage+MultiFormat.h" 10 | #import "UIImage+GIF.h" 11 | #import "NSData+ImageContentType.h" 12 | #import 13 | 14 | #ifdef SD_WEBP 15 | #import "UIImage+WebP.h" 16 | #endif 17 | 18 | @implementation UIImage (MultiFormat) 19 | 20 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { 21 | if (!data) { 22 | return nil; 23 | } 24 | 25 | UIImage *image; 26 | SDImageFormat imageFormat = [NSData sd_imageFormatForImageData:data]; 27 | if (imageFormat == SDImageFormatGIF) { 28 | image = [UIImage sd_animatedGIFWithData:data]; 29 | } 30 | #ifdef SD_WEBP 31 | else if (imageFormat == SDImageFormatWebP) 32 | { 33 | image = [UIImage sd_imageWithWebPData:data]; 34 | } 35 | #endif 36 | else { 37 | image = [[UIImage alloc] initWithData:data]; 38 | #if SD_UIKIT || SD_WATCH 39 | UIImageOrientation orientation = [self sd_imageOrientationFromImageData:data]; 40 | if (orientation != UIImageOrientationUp) { 41 | image = [UIImage imageWithCGImage:image.CGImage 42 | scale:image.scale 43 | orientation:orientation]; 44 | } 45 | #endif 46 | } 47 | 48 | 49 | return image; 50 | } 51 | 52 | #if SD_UIKIT || SD_WATCH 53 | +(UIImageOrientation)sd_imageOrientationFromImageData:(nonnull NSData *)imageData { 54 | UIImageOrientation result = UIImageOrientationUp; 55 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); 56 | if (imageSource) { 57 | CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); 58 | if (properties) { 59 | CFTypeRef val; 60 | int exifOrientation; 61 | val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); 62 | if (val) { 63 | CFNumberGetValue(val, kCFNumberIntType, &exifOrientation); 64 | result = [self sd_exifOrientationToiOSOrientation:exifOrientation]; 65 | } // else - if it's not set it remains at up 66 | CFRelease((CFTypeRef) properties); 67 | } else { 68 | //NSLog(@"NO PROPERTIES, FAIL"); 69 | } 70 | CFRelease(imageSource); 71 | } 72 | return result; 73 | } 74 | 75 | #pragma mark EXIF orientation tag converter 76 | // Convert an EXIF image orientation to an iOS one. 77 | // reference see here: http://sylvana.net/jpegcrop/exif_orientation.html 78 | + (UIImageOrientation) sd_exifOrientationToiOSOrientation:(int)exifOrientation { 79 | UIImageOrientation orientation = UIImageOrientationUp; 80 | switch (exifOrientation) { 81 | case 1: 82 | orientation = UIImageOrientationUp; 83 | break; 84 | 85 | case 3: 86 | orientation = UIImageOrientationDown; 87 | break; 88 | 89 | case 8: 90 | orientation = UIImageOrientationLeft; 91 | break; 92 | 93 | case 6: 94 | orientation = UIImageOrientationRight; 95 | break; 96 | 97 | case 2: 98 | orientation = UIImageOrientationUpMirrored; 99 | break; 100 | 101 | case 4: 102 | orientation = UIImageOrientationDownMirrored; 103 | break; 104 | 105 | case 5: 106 | orientation = UIImageOrientationLeftMirrored; 107 | break; 108 | 109 | case 7: 110 | orientation = UIImageOrientationRightMirrored; 111 | break; 112 | default: 113 | break; 114 | } 115 | return orientation; 116 | } 117 | #endif 118 | 119 | - (nullable NSData *)sd_imageData { 120 | return [self sd_imageDataAsFormat:SDImageFormatUndefined]; 121 | } 122 | 123 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { 124 | NSData *imageData = nil; 125 | if (self) { 126 | #if SD_UIKIT || SD_WATCH 127 | int alphaInfo = CGImageGetAlphaInfo(self.CGImage); 128 | BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || 129 | alphaInfo == kCGImageAlphaNoneSkipFirst || 130 | alphaInfo == kCGImageAlphaNoneSkipLast); 131 | 132 | BOOL usePNG = hasAlpha; 133 | 134 | // the imageFormat param has priority here. But if the format is undefined, we relly on the alpha channel 135 | if (imageFormat != SDImageFormatUndefined) { 136 | usePNG = (imageFormat == SDImageFormatPNG); 137 | } 138 | 139 | if (usePNG) { 140 | imageData = UIImagePNGRepresentation(self); 141 | } else { 142 | imageData = UIImageJPEGRepresentation(self, (CGFloat)1.0); 143 | } 144 | #else 145 | NSBitmapImageFileType imageFileType = NSJPEGFileType; 146 | if (imageFormat == SDImageFormatGIF) { 147 | imageFileType = NSGIFFileType; 148 | } else if (imageFormat == SDImageFormatPNG) { 149 | imageFileType = NSPNGFileType; 150 | } 151 | 152 | imageData = [NSBitmapImageRep representationOfImageRepsInArray:self.representations 153 | usingType:imageFileType 154 | properties:@{}]; 155 | #endif 156 | } 157 | return imageData; 158 | } 159 | 160 | 161 | @end 162 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+WebCache.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | @implementation UIImageView (WebCache) 18 | 19 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 20 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 21 | } 22 | 23 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 24 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 25 | } 26 | 27 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 28 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 29 | } 30 | 31 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 32 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 33 | } 34 | 35 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 36 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 37 | } 38 | 39 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 40 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 41 | } 42 | 43 | - (void)sd_setImageWithURL:(nullable NSURL *)url 44 | placeholderImage:(nullable UIImage *)placeholder 45 | options:(SDWebImageOptions)options 46 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 47 | completed:(nullable SDExternalCompletionBlock)completedBlock { 48 | [self sd_internalSetImageWithURL:url 49 | placeholderImage:placeholder 50 | options:options 51 | operationKey:nil 52 | setImageBlock:nil 53 | progress:progressBlock 54 | completed:completedBlock]; 55 | } 56 | 57 | - (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url 58 | placeholderImage:(nullable UIImage *)placeholder 59 | options:(SDWebImageOptions)options 60 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 61 | completed:(nullable SDExternalCompletionBlock)completedBlock { 62 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url]; 63 | UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromCacheForKey:key]; 64 | 65 | [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock]; 66 | } 67 | 68 | #if SD_UIKIT 69 | 70 | #pragma mark - Animation of multiple images 71 | 72 | - (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs { 73 | [self sd_cancelCurrentAnimationImagesLoad]; 74 | __weak __typeof(self)wself = self; 75 | 76 | NSMutableArray> *operationsArray = [[NSMutableArray alloc] init]; 77 | 78 | [arrayOfURLs enumerateObjectsUsingBlock:^(NSURL *logoImageURL, NSUInteger idx, BOOL * _Nonnull stop) { 79 | id operation = [SDWebImageManager.sharedManager loadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 80 | if (!wself) return; 81 | dispatch_main_async_safe(^{ 82 | __strong UIImageView *sself = wself; 83 | [sself stopAnimating]; 84 | if (sself && image) { 85 | NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; 86 | if (!currentImages) { 87 | currentImages = [[NSMutableArray alloc] init]; 88 | } 89 | 90 | // We know what index objects should be at when they are returned so 91 | // we will put the object at the index, filling any empty indexes 92 | // with the image that was returned too "early". These images will 93 | // be overwritten. (does not require additional sorting datastructure) 94 | while ([currentImages count] < idx) { 95 | [currentImages addObject:image]; 96 | } 97 | 98 | currentImages[idx] = image; 99 | 100 | sself.animationImages = currentImages; 101 | [sself setNeedsLayout]; 102 | } 103 | [sself startAnimating]; 104 | }); 105 | }]; 106 | [operationsArray addObject:operation]; 107 | }]; 108 | 109 | [self sd_setImageLoadOperation:[operationsArray copy] forKey:@"UIImageViewAnimationImages"]; 110 | } 111 | 112 | - (void)sd_cancelCurrentAnimationImagesLoad { 113 | [self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"]; 114 | } 115 | #endif 116 | 117 | @end 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-DMLPhotoBrowser_Example/Pods-DMLPhotoBrowser_Example-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 12 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 13 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 14 | 15 | case "${TARGETED_DEVICE_FAMILY}" in 16 | 1,2) 17 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 18 | ;; 19 | 1) 20 | TARGET_DEVICE_ARGS="--target-device iphone" 21 | ;; 22 | 2) 23 | TARGET_DEVICE_ARGS="--target-device ipad" 24 | ;; 25 | 3) 26 | TARGET_DEVICE_ARGS="--target-device tv" 27 | ;; 28 | 4) 29 | TARGET_DEVICE_ARGS="--target-device watch" 30 | ;; 31 | *) 32 | TARGET_DEVICE_ARGS="--target-device mac" 33 | ;; 34 | esac 35 | 36 | install_resource() 37 | { 38 | if [[ "$1" = /* ]] ; then 39 | RESOURCE_PATH="$1" 40 | else 41 | RESOURCE_PATH="${PODS_ROOT}/$1" 42 | fi 43 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 44 | cat << EOM 45 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 46 | EOM 47 | exit 1 48 | fi 49 | case $RESOURCE_PATH in 50 | *.storyboard) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.xib) 55 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 56 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 57 | ;; 58 | *.framework) 59 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 60 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 61 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 62 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 63 | ;; 64 | *.xcdatamodel) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 67 | ;; 68 | *.xcdatamodeld) 69 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 70 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 71 | ;; 72 | *.xcmappingmodel) 73 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 74 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 75 | ;; 76 | *.xcassets) 77 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 78 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 79 | ;; 80 | *) 81 | echo "$RESOURCE_PATH" || true 82 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 83 | ;; 84 | esac 85 | } 86 | 87 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 89 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 90 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | fi 93 | rm -f "$RESOURCES_TO_COPY" 94 | 95 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 96 | then 97 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 98 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 99 | while read line; do 100 | if [[ $line != "${PODS_ROOT}*" ]]; then 101 | XCASSET_FILES+=("$line") 102 | fi 103 | done <<<"$OTHER_XCASSETS" 104 | 105 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 106 | fi 107 | --------------------------------------------------------------------------------