├── Podfile ├── Pods ├── Headers │ ├── Public │ │ └── SDWebImage │ │ │ ├── UIImage+GIF.h │ │ │ ├── SDImageCache.h │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── SDWebImageManager.h │ │ │ ├── UIButton+WebCache.h │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImageOperation.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── UIImageView+WebCache.h │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── UIView+WebCacheOperation.h │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ └── UIImageView+HighlightedWebCache.h │ └── Private │ │ └── SDWebImage │ │ ├── SDImageCache.h │ │ ├── UIImage+GIF.h │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageManager.h │ │ ├── UIButton+WebCache.h │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImageView+WebCache.h │ │ ├── NSData+ImageContentType.h │ │ ├── UIView+WebCacheOperation.h │ │ ├── SDWebImageDownloaderOperation.h │ │ └── UIImageView+HighlightedWebCache.h ├── Target Support Files │ ├── Pods-SDWebImage │ │ ├── Pods-SDWebImage.xcconfig │ │ ├── Pods-SDWebImage-prefix.pch │ │ ├── Pods-SDWebImage-dummy.m │ │ └── Pods-SDWebImage-Private.xcconfig │ └── Pods │ │ ├── Pods-dummy.m │ │ ├── Pods.debug.xcconfig │ │ ├── Pods.release.xcconfig │ │ ├── Pods-environment.h │ │ ├── Pods-acknowledgements.markdown │ │ ├── Pods-acknowledgements.plist │ │ └── Pods-resources.sh ├── Manifest.lock ├── SDWebImage │ ├── SDWebImage │ │ ├── UIImage+MultiFormat.h │ │ ├── SDWebImageOperation.h │ │ ├── UIImage+GIF.h │ │ ├── SDWebImageDecoder.h │ │ ├── NSData+ImageContentType.h │ │ ├── UIView+WebCacheOperation.h │ │ ├── NSData+ImageContentType.m │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageCompat.h │ │ ├── UIView+WebCacheOperation.m │ │ ├── SDWebImageDecoder.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── UIImage+MultiFormat.m │ │ ├── SDWebImagePrefetcher.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImage+GIF.m │ │ ├── SDWebImagePrefetcher.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDImageCache.h │ │ ├── UIImageView+WebCache.m │ │ └── UIImageView+WebCache.h │ └── LICENSE └── Pods.xcodeproj │ └── xcuserdata │ └── Ronaldinho.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ ├── Pods.xcscheme │ └── Pods-SDWebImage.xcscheme ├── newsDt.png ├── WebNewsJSBridgeOC.gif ├── css └── fence.css ├── WebNewsJSBridgeOC.xcodeproj ├── xcuserdata │ └── Ronaldinho.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── WebNewsJSBridgeOC.xcscheme └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ └── Ronaldinho.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── WebNewsJSBridgeOC.xcworkspace ├── xcuserdata │ └── Ronaldinho.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── UserInterfaceState.xcuserstate ├── contents.xcworkspacedata └── xcshareddata │ └── WebNewsJSBridgeOC.xccheckout ├── Podfile.lock ├── WebNewsJSBridgeOC ├── ViewController.h ├── ViewImageVC.h ├── AppDelegate.h ├── NSString+Separate.h ├── main.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── NSString+Separate.m ├── Info.plist ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── ViewImageVC.m └── ViewController.m ├── README.md ├── js └── npm.js ├── KYPhotoGallery ├── PhotoGalleryScrollView │ ├── PhotoZoomScrollView.h │ ├── PhotoGalleryImageView.h │ ├── PhotoGalleryScrollView.h │ ├── PhotoGalleryImageView.m │ ├── PhotoZoomScrollView.m │ └── PhotoGalleryScrollView.m ├── KYPhotoGallery.h └── Helpers │ ├── Macro.h │ └── UCZProgressView.h ├── WebNewsJSBridgeOCTests ├── Info.plist └── WebNewsJSBridgeOCTests.m ├── WebViewJavascriptBridge ├── WKWebViewJavascriptBridge.h ├── WebViewJavascriptBridgeBase.h ├── WebViewJavascriptBridge.h ├── WebViewJavascriptBridge.js.txt ├── WKWebViewJavascriptBridge.m ├── WebViewJavascriptBridgeBase.m └── WebViewJavascriptBridge.m └── news.html /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | pod 'SDWebImage', '~>3.7.1' 3 | -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /newsDt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HotWordland/WebNewsJSBridgeOC/HEAD/newsDt.png -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HotWordland/WebNewsJSBridgeOC/HEAD/WebNewsJSBridgeOC.gif -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SDWebImage/Pods-SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_SDWEBIMAGE_OTHER_LDFLAGS = -framework "ImageIO" -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SDWebImage/Pods-SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /css/fence.css: -------------------------------------------------------------------------------- 1 | .body 2 | { 3 | position: absolute; 4 | } 5 | .about_icon .imgwap 6 | { 7 | text-align: center; 8 | } 9 | .about_icon img { 10 | width: 300px; 11 | height: auto; 12 | } -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcodeproj/xcuserdata/Ronaldinho.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcworkspace/xcuserdata/Ronaldinho.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SDWebImage/Pods-SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcworkspace/xcuserdata/Ronaldinho.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HotWordland/WebNewsJSBridgeOC/HEAD/WebNewsJSBridgeOC.xcworkspace/xcuserdata/Ronaldinho.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcodeproj/project.xcworkspace/xcuserdata/Ronaldinho.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HotWordland/WebNewsJSBridgeOC/HEAD/WebNewsJSBridgeOC.xcodeproj/project.xcworkspace/xcuserdata/Ronaldinho.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SDWebImage (3.7.3): 3 | - SDWebImage/Core (= 3.7.3) 4 | - SDWebImage/Core (3.7.3) 5 | 6 | DEPENDENCIES: 7 | - SDWebImage (~> 3.7.1) 8 | 9 | SPEC CHECKSUMS: 10 | SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84 11 | 12 | COCOAPODS: 0.36.0 13 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SDWebImage (3.7.3): 3 | - SDWebImage/Core (= 3.7.3) 4 | - SDWebImage/Core (3.7.3) 5 | 6 | DEPENDENCIES: 7 | - SDWebImage (~> 3.7.1) 8 | 9 | SPEC CHECKSUMS: 10 | SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84 11 | 12 | COCOAPODS: 0.36.0 13 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/20. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/ViewImageVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewImageVC.h 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/21. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewImageVC : UIViewController 12 | -(instancetype)initWithImageView:(UIImageView *)imParam; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.h 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (MultiFormat) 12 | 13 | + (UIImage *)sd_imageWithData:(NSData *)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/20. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/NSString+Separate.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Separate.h 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/21. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (Separate) 12 | - (NSString *)SeparateFromString:(NSString *)fromString ToString:(NSString *)toString; 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SDWebImage/Pods-SDWebImage-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-SDWebImage.xcconfig" 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/SDWebImage" 4 | OTHER_LDFLAGS = ${PODS_SDWEBIMAGE_OTHER_LDFLAGS} -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/20. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 2016 - 01 -24 替换html里一些失效的图片 2 | # WebNewsJSBridgeOC 3 | 一个完整的OC与JS交互 实现WebView里面的图片不用每次从网页加载 只需要第一次加载后就缓存 图片点击放大浏览 4 | # 演示 5 | 6 | # 点击浏览放大 7 | ![](https://github.com/HotWordland/WebNewsJSBridgeOC/blob/master/WebNewsJSBridgeOC.gif) 8 | 9 | # 思路 10 | 不加载html里的图片:替换HTML文本中默认的src 然后用SDWebImage将其url捕获进行缓存 等到缓存完后再进行替换Html。 11 | 点击放大:利用js交互 将html里的图片位置进行计算然后传递给OC 然后得到数据后进行页面上UI的逻辑处理 12 | 13 | ## LonLonStudio - WL -(重庆开发者巫龙 ^_^) http://codercq.com/ 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-SDWebImage" -framework "ImageIO" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-SDWebImage" -framework "ImageIO" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.h 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GIF) 12 | 13 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name; 14 | 15 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 16 | 17 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import 12 | #import "SDWebImageCompat.h" 13 | 14 | @interface UIImage (ForceDecode) 15 | 16 | + (UIImage *)decodedImageWithImage:(UIImage *)image; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /KYPhotoGallery/PhotoGalleryScrollView/PhotoZoomScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoZoomScrollView.h 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 6/5/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KYPhotoGallery.h" 11 | #import "PhotoGalleryImageView.h" 12 | 13 | @interface PhotoZoomScrollView : UIScrollView 14 | 15 | 16 | @property (nonatomic,strong)PhotoGalleryImageView *currentPhoto; 17 | 18 | 19 | -(id)initWithPhotoGallery:(KYPhotoGallery *)photoGallery; 20 | - (void)layout; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /KYPhotoGallery/PhotoGalleryScrollView/PhotoGalleryImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoGalleryImageView.h 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 5/31/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol DetectingImageViewDelegate 12 | @optional 13 | - (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch; 14 | - (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch; 15 | @end 16 | 17 | @interface PhotoGalleryImageView : UIImageView 18 | 19 | @property (nonatomic, assign) id tapDelegate; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface NSData (ImageContentType) 9 | 10 | /** 11 | * Compute the content type for an image data 12 | * 13 | * @param data the input data 14 | * 15 | * @return the content type as string (i.e. image/jpeg, image/gif) 16 | */ 17 | + (NSString *)sd_contentTypeForImageData:(NSData *)data; 18 | 19 | @end 20 | 21 | 22 | @interface NSData (ImageContentTypeDeprecated) 23 | 24 | + (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // SDWebImage 10 | #define COCOAPODS_POD_AVAILABLE_SDWebImage 11 | #define COCOAPODS_VERSION_MAJOR_SDWebImage 3 12 | #define COCOAPODS_VERSION_MINOR_SDWebImage 7 13 | #define COCOAPODS_VERSION_PATCH_SDWebImage 3 14 | 15 | // SDWebImage/Core 16 | #define COCOAPODS_POD_AVAILABLE_SDWebImage_Core 17 | #define COCOAPODS_VERSION_MAJOR_SDWebImage_Core 3 18 | #define COCOAPODS_VERSION_MINOR_SDWebImage_Core 7 19 | #define COCOAPODS_VERSION_PATCH_SDWebImage_Core 3 20 | 21 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcodeproj/xcuserdata/Ronaldinho.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | WebNewsJSBridgeOC.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | FE2796961B85BE00004AD719 16 | 17 | primary 18 | 19 | 20 | FE2796AF1B85BE00004AD719 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/Ronaldinho.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-SDWebImage.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 31B6E5E1188C531942A1F864 21 | 22 | primary 23 | 24 | 25 | FD296D0C8434EC1C526F0E58 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/NSString+Separate.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Separate.m 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/21. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import "NSString+Separate.h" 10 | 11 | @implementation NSString (Separate) 12 | - (NSString *)SeparateFromString:(NSString *)fromString ToString:(NSString *)toString { 13 | NSString *selfString = self; 14 | if (fromString && [selfString rangeOfString:fromString].length) { 15 | selfString = [selfString substringFromIndex:[selfString rangeOfString:fromString].location + fromString.length]; 16 | } 17 | if (toString && [selfString rangeOfString:toString].length) { 18 | selfString = [selfString substringToIndex:[selfString rangeOfString:toString].location]; 19 | } 20 | 21 | return selfString; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOCTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.HotWordLand.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /KYPhotoGallery/KYPhotoGallery.h: -------------------------------------------------------------------------------- 1 | // 2 | // KYPhotoGallery.h 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 5/31/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface KYPhotoGallery : UIViewController 12 | 13 | 14 | /* 15 | * 16 | @parm: tappedImageView 当前点击的图片视图 17 | @parm: imagesUrls 所有图片的URL链接 18 | @parm: currentIndex 当前图片的序号,第一张图请传入1,第二张为2,以此类推... 19 | * 20 | */ 21 | -(id)initWithTappedImageView:(UIImageView *)tappedImageView andImageUrls:(NSMutableArray *)imagesUrls andInitialIndex:(NSInteger )currentIndex dismissBlock:(void(^)() )block; 22 | 23 | 24 | /* 25 | * 26 | @property 所有需要显示的UIImageView 27 | * 28 | */ 29 | @property(nonatomic,strong)NSMutableArray *imageViewArray; 30 | 31 | 32 | -(void)dismissPhotoGalleryAnimated:(BOOL)animated; 33 | -(void)finishAsynDownload:(void(^)(void))finishAsynDownloadBlock; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /KYPhotoGallery/PhotoGalleryScrollView/PhotoGalleryScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoGalleryScrollView.h 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 5/31/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PhotoGalleryImageView.h" 11 | 12 | @class KYPhotoGallery; 13 | @interface PhotoGalleryScrollView : UIScrollView 14 | 15 | @property (nonatomic,strong)NSMutableArray *photos; //ScrollView上的所有照片 16 | 17 | 18 | -(id)initWithFrame:(CGRect)frame imageViews:(NSMutableArray *)imageViewArray initialPageIndex:(NSInteger)initialPageIndex withPhotoGallery:(KYPhotoGallery *)photoGallery; 19 | -(void)DidScrollBlock:(void(^)(NSInteger currentIndex))didEndScrollBlock; 20 | -(void)DidEndDecelerateBlock:(void(^)(NSInteger currentIndex))didEndDeceleratBlock; 21 | -(NSInteger)currentIndex; // 当前图片的编号 22 | -(PhotoGalleryImageView *)currentPhoto; // 当前图片 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOCTests/WebNewsJSBridgeOCTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // WebNewsJSBridgeOCTests.m 3 | // WebNewsJSBridgeOCTests 4 | // 5 | // Created by Ronaldinho on 15/8/20. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WebNewsJSBridgeOCTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation WebNewsJSBridgeOCTests 17 | 18 | - (void)setUp { 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 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Olivier Poitrey 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 | -------------------------------------------------------------------------------- /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 10 | #import "SDWebImageManager.h" 11 | 12 | @interface UIView (WebCacheOperation) 13 | 14 | /** 15 | * Set the image load operation (storage in a UIView based dictionary) 16 | * 17 | * @param operation the operation 18 | * @param key key for storing the operation 19 | */ 20 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key; 21 | 22 | /** 23 | * Cancel all operations for the current UIView and key 24 | * 25 | * @param key key for identifying the operations 26 | */ 27 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key; 28 | 29 | /** 30 | * Just remove the operations corresponding to the current UIView and key without cancelling them 31 | * 32 | * @param key key for identifying the operations 33 | */ 34 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## SDWebImage 5 | 6 | Copyright (c) 2009 Olivier Poitrey 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 furnished 13 | to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | 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 | Generated by CocoaPods - http://cocoapods.org 28 | -------------------------------------------------------------------------------- /KYPhotoGallery/Helpers/Macro.h: -------------------------------------------------------------------------------- 1 | // 2 | // Macro.h 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 5/31/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #ifndef KYElegantPhotoGallery_Demo_Macro_h 10 | #define KYElegantPhotoGallery_Demo_Macro_h 11 | 12 | 13 | #endif 14 | 15 | 16 | #define SCREENWIDTH [UIScreen mainScreen].bounds.size.width 17 | #define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height 18 | #define PHOTOS_SPACING 20 19 | #define ANIMATEDURATION 0.3 20 | #define ANIMATEDAMPING 1.0 21 | #define SCROLLDISTANCE 200.0 22 | 23 | 24 | // 识别系统版本 25 | #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) 26 | #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) 27 | #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) 28 | #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) 29 | #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) 30 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import "NSData+ImageContentType.h" 7 | 8 | 9 | @implementation NSData (ImageContentType) 10 | 11 | + (NSString *)sd_contentTypeForImageData:(NSData *)data { 12 | uint8_t c; 13 | [data getBytes:&c length:1]; 14 | switch (c) { 15 | case 0xFF: 16 | return @"image/jpeg"; 17 | case 0x89: 18 | return @"image/png"; 19 | case 0x47: 20 | return @"image/gif"; 21 | case 0x49: 22 | case 0x4D: 23 | return @"image/tiff"; 24 | case 0x52: 25 | // R as RIFF for WEBP 26 | if ([data length] < 12) { 27 | return nil; 28 | } 29 | 30 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 31 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 32 | return @"image/webp"; 33 | } 34 | 35 | return nil; 36 | } 37 | return nil; 38 | } 39 | 40 | @end 41 | 42 | 43 | @implementation NSData (ImageContentTypeDeprecated) 44 | 45 | + (NSString *)contentTypeForImageData:(NSData *)data { 46 | return [self sd_contentTypeForImageData:data]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /KYPhotoGallery/Helpers/UCZProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // UCZProgressView.h 3 | // UCZProgressView 4 | // 5 | // Created by kishikawa katsumi on 12/13/2014. 6 | // Copyright (c) 2014 kishikawa katsumi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | IB_DESIGNABLE 12 | 13 | @interface UCZProgressView : UIView 14 | 15 | @property (nonatomic) IBInspectable BOOL indeterminate; 16 | @property (nonatomic) IBInspectable CGFloat progress; 17 | @property (nonatomic) IBInspectable BOOL showsText; // UI_APPEARANCE_SELECTOR; 18 | 19 | @property (nonatomic) IBInspectable CGFloat lineWidth; // UI_APPEARANCE_SELECTOR; 20 | @property (nonatomic) IBInspectable CGFloat radius; // UI_APPEARANCE_SELECTOR; 21 | @property (nonatomic) IBInspectable UIColor *tintColor; // UI_APPEARANCE_SELECTOR; 22 | @property (nonatomic) UIView *backgroundView; // UI_APPEARANCE_SELECTOR; 23 | 24 | @property (nonatomic, readonly) UILabel *textLabel; // UI_APPEARANCE_SELECTOR; 25 | @property (nonatomic) IBInspectable UIColor *textColor; // UI_APPEARANCE_SELECTOR; 26 | @property (nonatomic) IBInspectable CGFloat textSize; // UI_APPEARANCE_SELECTOR; 27 | 28 | @property (nonatomic) UIBlurEffect *blurEffect NS_AVAILABLE_IOS(8_0); // UI_APPEARANCE_SELECTOR; 29 | @property (nonatomic) IBInspectable BOOL usesVibrancyEffect; // UI_APPEARANCE_SELECTOR; 30 | 31 | - (void)setProgress:(CGFloat)progress animated:(BOOL)animated; 32 | - (void)progressAnimiationDidStop:(void(^)(void))block; 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.HotWordLand.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | NSAppTransportSecurity 40 | NSAllowsArbitraryLoads 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WebViewJavascriptBridge/WKWebViewJavascriptBridge.h: -------------------------------------------------------------------------------- 1 | // 2 | // WKWebViewJavascriptBridge.h 3 | // 4 | // Created by @LokiMeyburg on 10/15/14. 5 | // Copyright (c) 2014 @LokiMeyburg. All rights reserved. 6 | // 7 | 8 | #if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9 || __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1) 9 | #define supportsWKWebKit 10 | #endif 11 | 12 | #if defined(supportsWKWebKit ) 13 | 14 | #import 15 | #import "WebViewJavascriptBridgeBase.h" 16 | #import 17 | 18 | @interface WKWebViewJavascriptBridge : NSObject 19 | 20 | + (instancetype)bridgeForWebView:(WKWebView*)webView handler:(WVJBHandler)handler; 21 | + (instancetype)bridgeForWebView:(WKWebView*)webView webViewDelegate:(NSObject*)webViewDelegate handler:(WVJBHandler)handler; 22 | + (instancetype)bridgeForWebView:(WKWebView*)webView webViewDelegate:(NSObject*)webViewDelegate handler:(WVJBHandler)handler resourceBundle:(NSBundle*)bundle; 23 | + (void)enableLogging; 24 | 25 | - (void)send:(id)message; 26 | - (void)send:(id)message responseCallback:(WVJBResponseCallback)responseCallback; 27 | - (void)registerHandler:(NSString*)handlerName handler:(WVJBHandler)handler; 28 | - (void)callHandler:(NSString*)handlerName; 29 | - (void)callHandler:(NSString*)handlerName data:(id)data; 30 | - (void)callHandler:(NSString*)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback; 31 | - (void)reset; 32 | 33 | @end 34 | 35 | #endif -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcworkspace/xcshareddata/WebNewsJSBridgeOC.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | A67A9C7F-6451-436F-976A-8B7B7573F02A 9 | IDESourceControlProjectName 10 | WebNewsJSBridgeOC 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 60AD2D699A819C364E4EB5C4017175F5614D8D58 14 | https://github.com/HotWordland/WebNewsJSBridgeOC.git 15 | 16 | IDESourceControlProjectPath 17 | WebNewsJSBridgeOC.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 60AD2D699A819C364E4EB5C4017175F5614D8D58 21 | .. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/HotWordland/WebNewsJSBridgeOC.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 60AD2D699A819C364E4EB5C4017175F5614D8D58 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 60AD2D699A819C364E4EB5C4017175F5614D8D58 36 | IDESourceControlWCCName 37 | WebNewsJSBridgeOC 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDWebImageCompat.m 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 11/12/12. 6 | // Copyright (c) 2012 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if !__has_feature(objc_arc) 12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 13 | #endif 14 | 15 | inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) { 16 | if (!image) { 17 | return nil; 18 | } 19 | 20 | if ([image.images count] > 0) { 21 | NSMutableArray *scaledImages = [NSMutableArray array]; 22 | 23 | for (UIImage *tempImage in image.images) { 24 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 25 | } 26 | 27 | return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 28 | } 29 | else { 30 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 31 | CGFloat scale = 1.0; 32 | if (key.length >= 8) { 33 | NSRange range = [key rangeOfString:@"@2x."]; 34 | if (range.location != NSNotFound) { 35 | scale = 2.0; 36 | } 37 | 38 | range = [key rangeOfString:@"@3x."]; 39 | if (range.location != NSNotFound) { 40 | scale = 3.0; 41 | } 42 | } 43 | 44 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 45 | image = scaledImage; 46 | } 47 | return image; 48 | } 49 | } 50 | 51 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 52 | -------------------------------------------------------------------------------- /WebViewJavascriptBridge/WebViewJavascriptBridgeBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewJavascriptBridgeBase.h 3 | // 4 | // Created by @LokiMeyburg on 10/15/14. 5 | // Copyright (c) 2014 @LokiMeyburg. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | #define kCustomProtocolScheme @"wvjbscheme" 11 | #define kQueueHasMessage @"__WVJB_QUEUE_MESSAGE__" 12 | 13 | typedef void (^WVJBResponseCallback)(id responseData); 14 | typedef void (^WVJBHandler)(id data, WVJBResponseCallback responseCallback); 15 | typedef NSDictionary WVJBMessage; 16 | 17 | @protocol WebViewJavascriptBridgeBaseDelegate 18 | - (NSString*) _evaluateJavascript:(NSString*)javascriptCommand; 19 | @end 20 | 21 | @interface WebViewJavascriptBridgeBase : NSObject 22 | 23 | 24 | @property (assign) id delegate; 25 | @property (strong, nonatomic) NSMutableArray* startupMessageQueue; 26 | @property (strong, nonatomic) NSMutableDictionary* responseCallbacks; 27 | @property (strong, nonatomic) NSMutableDictionary* messageHandlers; 28 | @property (strong, nonatomic) WVJBHandler messageHandler; 29 | @property NSUInteger numRequestsLoading; 30 | 31 | + (void)enableLogging; 32 | - (id)initWithHandler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle; 33 | - (void)reset; 34 | - (void)sendData:(id)data responseCallback:(WVJBResponseCallback)responseCallback handlerName:(NSString*)handlerName; 35 | - (void)flushMessageQueue:(NSString *)messageQueueString; 36 | - (void)injectJavascriptFile:(BOOL)shouldInject; 37 | - (BOOL)isCorrectProcotocolScheme:(NSURL*)url; 38 | - (BOOL)isCorrectHost:(NSURL*)urll; 39 | - (void)logUnkownMessage:(NSURL*)url; 40 | - (void)dispatchStartUpMessageQueue; 41 | - (NSString *)webViewJavascriptCheckCommand; 42 | - (NSString *)webViewJavascriptFetchQueyCommand; 43 | 44 | @end -------------------------------------------------------------------------------- /WebViewJavascriptBridge/WebViewJavascriptBridge.h: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewJavascriptBridge.h 3 | // ExampleApp-iOS 4 | // 5 | // Created by Marcus Westin on 6/14/13. 6 | // Copyright (c) 2013 Marcus Westin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WebViewJavascriptBridgeBase.h" 11 | 12 | #if defined __MAC_OS_X_VERSION_MAX_ALLOWED 13 | #import 14 | #define WVJB_PLATFORM_OSX 15 | #define WVJB_WEBVIEW_TYPE WebView 16 | #define WVJB_WEBVIEW_DELEGATE_TYPE NSObject 17 | #define WVJB_WEBVIEW_DELEGATE_INTERFACE NSObject 18 | #elif defined __IPHONE_OS_VERSION_MAX_ALLOWED 19 | #import 20 | #define WVJB_PLATFORM_IOS 21 | #define WVJB_WEBVIEW_TYPE UIWebView 22 | #define WVJB_WEBVIEW_DELEGATE_TYPE NSObject 23 | #define WVJB_WEBVIEW_DELEGATE_INTERFACE NSObject 24 | #endif 25 | 26 | @interface WebViewJavascriptBridge : WVJB_WEBVIEW_DELEGATE_INTERFACE 27 | 28 | + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView handler:(WVJBHandler)handler; 29 | + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WVJB_WEBVIEW_DELEGATE_TYPE*)webViewDelegate handler:(WVJBHandler)handler; 30 | + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WVJB_WEBVIEW_DELEGATE_TYPE*)webViewDelegate handler:(WVJBHandler)handler resourceBundle:(NSBundle*)bundle; 31 | + (void)enableLogging; 32 | 33 | - (void)send:(id)message; 34 | - (void)send:(id)message responseCallback:(WVJBResponseCallback)responseCallback; 35 | - (void)registerHandler:(NSString*)handlerName handler:(WVJBHandler)handler; 36 | - (void)callHandler:(NSString*)handlerName; 37 | - (void)callHandler:(NSString*)handlerName data:(id)data; 38 | - (void)callHandler:(NSString*)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /KYPhotoGallery/PhotoGalleryScrollView/PhotoGalleryImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoGalleryImageView.m 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 5/31/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import "PhotoGalleryImageView.h" 10 | 11 | @interface PhotoGalleryImageView() 12 | 13 | - (void)handleSingleTap:(UITouch *)touch; 14 | - (void)handleDoubleTap:(UITouch *)touch; 15 | 16 | @end 17 | 18 | @implementation PhotoGalleryImageView 19 | 20 | - (id)initWithFrame:(CGRect)frame { 21 | if ((self = [super initWithFrame:frame])) { 22 | self.userInteractionEnabled = YES; 23 | } 24 | return self; 25 | } 26 | 27 | - (id)initWithImage:(UIImage *)image { 28 | if ((self = [super initWithImage:image])) { 29 | self.userInteractionEnabled = YES; 30 | } 31 | return self; 32 | } 33 | 34 | - (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage { 35 | if ((self = [super initWithImage:image highlightedImage:highlightedImage])) { 36 | self.userInteractionEnabled = YES; 37 | } 38 | return self; 39 | } 40 | 41 | #pragma mark -- UIResponder method 42 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 43 | UITouch *touch = [touches anyObject]; 44 | NSUInteger tapCount = touch.tapCount; 45 | 46 | 47 | switch (tapCount) { 48 | case 1: 49 | [self handleSingleTap:touch]; 50 | break; 51 | case 2: 52 | [self handleDoubleTap:touch]; 53 | break; 54 | default: 55 | break; 56 | } 57 | 58 | } 59 | 60 | 61 | 62 | 63 | #pragma mark -- Private method 64 | - (void)handleSingleTap:(UITouch *)touch { 65 | if ([self.tapDelegate respondsToSelector:@selector(imageView:singleTapDetected:)]) 66 | [self.tapDelegate imageView:self singleTapDetected:touch]; 67 | 68 | } 69 | 70 | - (void)handleDoubleTap:(UITouch *)touch { 71 | if ([self.tapDelegate respondsToSelector:@selector(imageView:doubleTapDetected:)]) 72 | [self.tapDelegate imageView:self doubleTapDetected:touch]; 73 | 74 | } 75 | 76 | 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /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 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 17 | #error SDWebImage doesn't support Deployement Target version < 5.0 18 | #endif 19 | 20 | #if !TARGET_OS_IPHONE 21 | #import 22 | #ifndef UIImage 23 | #define UIImage NSImage 24 | #endif 25 | #ifndef UIImageView 26 | #define UIImageView NSImageView 27 | #endif 28 | #else 29 | 30 | #import 31 | 32 | #endif 33 | 34 | #ifndef NS_ENUM 35 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 36 | #endif 37 | 38 | #ifndef NS_OPTIONS 39 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 40 | #endif 41 | 42 | #if OS_OBJECT_USE_OBJC 43 | #undef SDDispatchQueueRelease 44 | #undef SDDispatchQueueSetterSementics 45 | #define SDDispatchQueueRelease(q) 46 | #define SDDispatchQueueSetterSementics strong 47 | #else 48 | #undef SDDispatchQueueRelease 49 | #undef SDDispatchQueueSetterSementics 50 | #define SDDispatchQueueRelease(q) (dispatch_release(q)) 51 | #define SDDispatchQueueSetterSementics assign 52 | #endif 53 | 54 | extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 55 | 56 | typedef void(^SDWebImageNoParamsBlock)(); 57 | 58 | extern NSString *const SDWebImageErrorDomain; 59 | 60 | #define dispatch_main_sync_safe(block)\ 61 | if ([NSThread isMainThread]) {\ 62 | block();\ 63 | } else {\ 64 | dispatch_sync(dispatch_get_main_queue(), block);\ 65 | } 66 | 67 | #define dispatch_main_async_safe(block)\ 68 | if ([NSThread isMainThread]) {\ 69 | block();\ 70 | } else {\ 71 | dispatch_async(dispatch_get_main_queue(), block);\ 72 | } 73 | -------------------------------------------------------------------------------- /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 | #import "objc/runtime.h" 11 | 12 | static char loadOperationKey; 13 | 14 | @implementation UIView (WebCacheOperation) 15 | 16 | - (NSMutableDictionary *)operationDictionary { 17 | NSMutableDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 18 | if (operations) { 19 | return operations; 20 | } 21 | operations = [NSMutableDictionary dictionary]; 22 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 23 | return operations; 24 | } 25 | 26 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key { 27 | [self sd_cancelImageLoadOperationWithKey:key]; 28 | NSMutableDictionary *operationDictionary = [self operationDictionary]; 29 | [operationDictionary setObject:operation forKey:key]; 30 | } 31 | 32 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key { 33 | // Cancel in progress downloader from queue 34 | NSMutableDictionary *operationDictionary = [self operationDictionary]; 35 | id operations = [operationDictionary objectForKey:key]; 36 | if (operations) { 37 | if ([operations isKindOfClass:[NSArray class]]) { 38 | for (id operation in operations) { 39 | if (operation) { 40 | [operation cancel]; 41 | } 42 | } 43 | } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){ 44 | [(id) operations cancel]; 45 | } 46 | [operationDictionary removeObjectForKey:key]; 47 | } 48 | } 49 | 50 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key { 51 | NSMutableDictionary *operationDictionary = [self operationDictionary]; 52 | [operationDictionary removeObjectForKey:key]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/20. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 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 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/Ronaldinho.xcuserdatad/xcschemes/Pods.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-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) 2009 Olivier Poitrey <rs@dailymotion.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 furnished 24 | to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in all 27 | 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 | 38 | Title 39 | SDWebImage 40 | Type 41 | PSGroupSpecifier 42 | 43 | 44 | FooterText 45 | Generated by CocoaPods - http://cocoapods.org 46 | Title 47 | 48 | Type 49 | PSGroupSpecifier 50 | 51 | 52 | StringsTable 53 | Acknowledgements 54 | Title 55 | Acknowledgements 56 | 57 | 58 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/Ronaldinho.xcuserdatad/xcschemes/Pods-SDWebImage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import "SDWebImageDecoder.h" 12 | 13 | @implementation UIImage (ForceDecode) 14 | 15 | + (UIImage *)decodedImageWithImage:(UIImage *)image { 16 | if (image.images) { 17 | // Do not decode animated images 18 | return image; 19 | } 20 | 21 | CGImageRef imageRef = image.CGImage; 22 | CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); 23 | CGRect imageRect = (CGRect){.origin = CGPointZero, .size = imageSize}; 24 | 25 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 26 | CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); 27 | 28 | int infoMask = (bitmapInfo & kCGBitmapAlphaInfoMask); 29 | BOOL anyNonAlpha = (infoMask == kCGImageAlphaNone || 30 | infoMask == kCGImageAlphaNoneSkipFirst || 31 | infoMask == kCGImageAlphaNoneSkipLast); 32 | 33 | // CGBitmapContextCreate doesn't support kCGImageAlphaNone with RGB. 34 | // https://developer.apple.com/library/mac/#qa/qa1037/_index.html 35 | if (infoMask == kCGImageAlphaNone && CGColorSpaceGetNumberOfComponents(colorSpace) > 1) { 36 | // Unset the old alpha info. 37 | bitmapInfo &= ~kCGBitmapAlphaInfoMask; 38 | 39 | // Set noneSkipFirst. 40 | bitmapInfo |= kCGImageAlphaNoneSkipFirst; 41 | } 42 | // Some PNGs tell us they have alpha but only 3 components. Odd. 43 | else if (!anyNonAlpha && CGColorSpaceGetNumberOfComponents(colorSpace) == 3) { 44 | // Unset the old alpha info. 45 | bitmapInfo &= ~kCGBitmapAlphaInfoMask; 46 | bitmapInfo |= kCGImageAlphaPremultipliedFirst; 47 | } 48 | 49 | // It calculates the bytes-per-row based on the bitsPerComponent and width arguments. 50 | CGContextRef context = CGBitmapContextCreate(NULL, 51 | imageSize.width, 52 | imageSize.height, 53 | CGImageGetBitsPerComponent(imageRef), 54 | 0, 55 | colorSpace, 56 | bitmapInfo); 57 | CGColorSpaceRelease(colorSpace); 58 | 59 | // If failed, return undecompressed image 60 | if (!context) return image; 61 | 62 | CGContextDrawImage(context, imageRect, imageRef); 63 | CGImageRef decompressedImageRef = CGBitmapContextCreateImage(context); 64 | 65 | CGContextRelease(context); 66 | 67 | UIImage *decompressedImage = [UIImage imageWithCGImage:decompressedImageRef scale:image.scale orientation:image.imageOrientation]; 68 | CGImageRelease(decompressedImageRef); 69 | return decompressedImage; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /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 | extern NSString *const SDWebImageDownloadStartNotification; 14 | extern NSString *const SDWebImageDownloadReceiveResponseNotification; 15 | extern NSString *const SDWebImageDownloadStopNotification; 16 | extern NSString *const SDWebImageDownloadFinishNotification; 17 | 18 | @interface SDWebImageDownloaderOperation : NSOperation 19 | 20 | /** 21 | * The request used by the operation's connection. 22 | */ 23 | @property (strong, nonatomic, readonly) NSURLRequest *request; 24 | 25 | 26 | @property (assign, nonatomic) BOOL shouldDecompressImages; 27 | 28 | /** 29 | * Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default. 30 | * 31 | * This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`. 32 | */ 33 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage; 34 | 35 | /** 36 | * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. 37 | * 38 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 39 | */ 40 | @property (nonatomic, strong) NSURLCredential *credential; 41 | 42 | /** 43 | * The SDWebImageDownloaderOptions for the receiver. 44 | */ 45 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 46 | 47 | /** 48 | * The expected size of data. 49 | */ 50 | @property (assign, nonatomic) NSInteger expectedSize; 51 | 52 | /** 53 | * The response returned by the operation's connection. 54 | */ 55 | @property (strong, nonatomic) NSURLResponse *response; 56 | 57 | /** 58 | * Initializes a `SDWebImageDownloaderOperation` object 59 | * 60 | * @see SDWebImageDownloaderOperation 61 | * 62 | * @param request the URL request 63 | * @param options downloader options 64 | * @param progressBlock the block executed when a new chunk of data arrives. 65 | * @note the progress block is executed on a background queue 66 | * @param completedBlock the block executed when the download is done. 67 | * @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 68 | * @param cancelBlock the block executed if the download (operation) is cancelled 69 | * 70 | * @return the initialized instance 71 | */ 72 | - (id)initWithRequest:(NSURLRequest *)request 73 | options:(SDWebImageDownloaderOptions)options 74 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 75 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock 76 | cancelled:(SDWebImageNoParamsBlock)cancelBlock; 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /KYPhotoGallery/PhotoGalleryScrollView/PhotoZoomScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoZoomScrollView.m 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 6/5/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import "PhotoZoomScrollView.h" 10 | 11 | 12 | 13 | @interface PhotoZoomScrollView() 14 | 15 | @property (nonatomic,strong)KYPhotoGallery *photoGallery; 16 | 17 | #pragma mark -- Private method 18 | - (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center; 19 | 20 | @end 21 | 22 | @implementation PhotoZoomScrollView 23 | 24 | -(id)initWithPhotoGallery:(KYPhotoGallery *)photoGallery{ 25 | self = [super init]; 26 | if (self) { 27 | _photoGallery = photoGallery; 28 | self.delegate = self; 29 | self.maximumZoomScale = 4.0f; 30 | 31 | } 32 | 33 | return self; 34 | } 35 | 36 | 37 | #pragma private method 38 | - (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center { 39 | CGRect zoomRect; 40 | 41 | zoomRect.size.height = [self frame].size.height / scale; 42 | zoomRect.size.width = [self frame].size.width / scale; 43 | zoomRect.origin.x = center.x - (zoomRect.size.width / 2.0); 44 | zoomRect.origin.y = center.y - (zoomRect.size.height / 2.0); 45 | 46 | return zoomRect; 47 | } 48 | 49 | 50 | #pragma mark -- Public method 51 | - (void)layout { 52 | 53 | // Center the image as it becomes smaller than the size of the screen 54 | CGSize boundsSize = self.bounds.size; 55 | CGRect frameToCenter = self.currentPhoto.frame; 56 | 57 | // Horizontally 58 | if (frameToCenter.size.width < boundsSize.width) { 59 | frameToCenter.origin.x = floorf((boundsSize.width - frameToCenter.size.width) / 2.0); 60 | } else { 61 | frameToCenter.origin.x = 0; 62 | } 63 | 64 | // Vertically 65 | if (frameToCenter.size.height < boundsSize.height) { 66 | frameToCenter.origin.y = floorf((boundsSize.height - frameToCenter.size.height) / 2.0); 67 | } else { 68 | frameToCenter.origin.y = 0; 69 | } 70 | 71 | // Center 72 | if (!CGRectEqualToRect(self.currentPhoto.frame, frameToCenter)) 73 | self.currentPhoto.frame = frameToCenter; 74 | } 75 | 76 | 77 | 78 | #pragma DetectingImageViewDelegate 79 | - (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch{ 80 | [self.photoGallery performSelector:@selector(dismissPhotoGalleryAnimated:) withObject:@(YES) afterDelay:0.2]; 81 | NSLog(@"singleTap"); 82 | } 83 | 84 | - (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch{ 85 | [NSObject cancelPreviousPerformRequestsWithTarget:self.photoGallery]; 86 | 87 | NSLog(@"doubleTap"); 88 | 89 | // Zoom 90 | if (self.zoomScale == self.maximumZoomScale) { 91 | 92 | // Zoom out 93 | [self setZoomScale:self.minimumZoomScale animated:YES]; 94 | 95 | } else { 96 | CGPoint touchPoint = [touch locationInView:imageView]; 97 | touchPoint = [self convertPoint:touchPoint fromView:imageView]; 98 | 99 | // Zoom in 100 | CGRect zoomRect = [self zoomRectForScale:self.maximumZoomScale withCenter:touchPoint]; 101 | [self zoomToRect:zoomRect animated:YES]; 102 | 103 | } 104 | 105 | } 106 | 107 | 108 | #pragma UISrollViewDelegate 109 | - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ 110 | return self.currentPhoto; 111 | } 112 | 113 | - (void)scrollViewDidZoom:(UIScrollView *)scrollView { 114 | [self layout]; 115 | } 116 | 117 | 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.m 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 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 | + (UIImage *)sd_imageWithData:(NSData *)data { 21 | if (!data) { 22 | return nil; 23 | } 24 | 25 | UIImage *image; 26 | NSString *imageContentType = [NSData sd_contentTypeForImageData:data]; 27 | if ([imageContentType isEqualToString:@"image/gif"]) { 28 | image = [UIImage sd_animatedGIFWithData:data]; 29 | } 30 | #ifdef SD_WEBP 31 | else if ([imageContentType isEqualToString:@"image/webp"]) 32 | { 33 | image = [UIImage sd_imageWithWebPData:data]; 34 | } 35 | #endif 36 | else { 37 | image = [[UIImage alloc] initWithData:data]; 38 | UIImageOrientation orientation = [self sd_imageOrientationFromImageData:data]; 39 | if (orientation != UIImageOrientationUp) { 40 | image = [UIImage imageWithCGImage:image.CGImage 41 | scale:image.scale 42 | orientation:orientation]; 43 | } 44 | } 45 | 46 | 47 | return image; 48 | } 49 | 50 | 51 | +(UIImageOrientation)sd_imageOrientationFromImageData:(NSData *)imageData { 52 | UIImageOrientation result = UIImageOrientationUp; 53 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); 54 | if (imageSource) { 55 | CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); 56 | if (properties) { 57 | CFTypeRef val; 58 | int exifOrientation; 59 | val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); 60 | if (val) { 61 | CFNumberGetValue(val, kCFNumberIntType, &exifOrientation); 62 | result = [self sd_exifOrientationToiOSOrientation:exifOrientation]; 63 | } // else - if it's not set it remains at up 64 | CFRelease((CFTypeRef) properties); 65 | } else { 66 | //NSLog(@"NO PROPERTIES, FAIL"); 67 | } 68 | CFRelease(imageSource); 69 | } 70 | return result; 71 | } 72 | 73 | #pragma mark EXIF orientation tag converter 74 | // Convert an EXIF image orientation to an iOS one. 75 | // reference see here: http://sylvana.net/jpegcrop/exif_orientation.html 76 | + (UIImageOrientation) sd_exifOrientationToiOSOrientation:(int)exifOrientation { 77 | UIImageOrientation orientation = UIImageOrientationUp; 78 | switch (exifOrientation) { 79 | case 1: 80 | orientation = UIImageOrientationUp; 81 | break; 82 | 83 | case 3: 84 | orientation = UIImageOrientationDown; 85 | break; 86 | 87 | case 8: 88 | orientation = UIImageOrientationLeft; 89 | break; 90 | 91 | case 6: 92 | orientation = UIImageOrientationRight; 93 | break; 94 | 95 | case 2: 96 | orientation = UIImageOrientationUpMirrored; 97 | break; 98 | 99 | case 4: 100 | orientation = UIImageOrientationDownMirrored; 101 | break; 102 | 103 | case 5: 104 | orientation = UIImageOrientationLeftMirrored; 105 | break; 106 | 107 | case 7: 108 | orientation = UIImageOrientationRightMirrored; 109 | break; 110 | default: 111 | break; 112 | } 113 | return orientation; 114 | } 115 | 116 | 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /WebViewJavascriptBridge/WebViewJavascriptBridge.js.txt: -------------------------------------------------------------------------------- 1 | ;(function() { 2 | if (window.WebViewJavascriptBridge) { return } 3 | var messagingIframe 4 | var sendMessageQueue = [] 5 | var receiveMessageQueue = [] 6 | var messageHandlers = {} 7 | 8 | var CUSTOM_PROTOCOL_SCHEME = 'wvjbscheme' 9 | var QUEUE_HAS_MESSAGE = '__WVJB_QUEUE_MESSAGE__' 10 | 11 | var responseCallbacks = {} 12 | var uniqueId = 1 13 | 14 | function _createQueueReadyIframe(doc) { 15 | messagingIframe = doc.createElement('iframe') 16 | messagingIframe.style.display = 'none' 17 | messagingIframe.src = CUSTOM_PROTOCOL_SCHEME + '://' + QUEUE_HAS_MESSAGE 18 | doc.documentElement.appendChild(messagingIframe) 19 | } 20 | 21 | function init(messageHandler) { 22 | if (WebViewJavascriptBridge._messageHandler) { throw new Error('WebViewJavascriptBridge.init called twice') } 23 | WebViewJavascriptBridge._messageHandler = messageHandler 24 | var receivedMessages = receiveMessageQueue 25 | receiveMessageQueue = null 26 | for (var i=0; i 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:(SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(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:(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) 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 (nonatomic, assign) dispatch_queue_t prefetcherQueue; 65 | 66 | @property (weak, nonatomic) id delegate; 67 | 68 | /** 69 | * Return the global image prefetcher instance. 70 | */ 71 | + (SDWebImagePrefetcher *)sharedImagePrefetcher; 72 | 73 | /** 74 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 75 | * currently one image is downloaded at a time, 76 | * and skips images for failed downloads and proceed to the next image in the list 77 | * 78 | * @param urls list of URLs to prefetch 79 | */ 80 | - (void)prefetchURLs:(NSArray *)urls; 81 | 82 | /** 83 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 84 | * currently one image is downloaded at a time, 85 | * and skips images for failed downloads and proceed to the next image in the list 86 | * 87 | * @param urls list of URLs to prefetch 88 | * @param progressBlock block to be called when progress updates; 89 | * first parameter is the number of completed (successful or not) requests, 90 | * second parameter is the total number of images originally requested to be prefetched 91 | * @param completionBlock block to be called when prefetching is completed 92 | * first param is the number of completed (successful or not) requests, 93 | * second parameter is the number of skipped requests 94 | */ 95 | - (void)prefetchURLs:(NSArray *)urls progress:(SDWebImagePrefetcherProgressBlock)progressBlock completed:(SDWebImagePrefetcherCompletionBlock)completionBlock; 96 | 97 | /** 98 | * Remove and cancel queued list 99 | */ 100 | - (void)cancelPrefetching; 101 | 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_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 | install_resource() 12 | { 13 | case $1 in 14 | *.storyboard) 15 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 16 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 17 | ;; 18 | *.xib) 19 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 20 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 21 | ;; 22 | *.framework) 23 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 24 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 25 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 26 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 27 | ;; 28 | *.xcdatamodel) 29 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 30 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 31 | ;; 32 | *.xcdatamodeld) 33 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 34 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 35 | ;; 36 | *.xcmappingmodel) 37 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 38 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 39 | ;; 40 | *.xcassets) 41 | XCASSET_FILES="$XCASSET_FILES '$1'" 42 | ;; 43 | /*) 44 | echo "$1" 45 | echo "$1" >> "$RESOURCES_TO_COPY" 46 | ;; 47 | *) 48 | echo "${PODS_ROOT}/$1" 49 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 50 | ;; 51 | esac 52 | } 53 | 54 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 55 | if [[ "${ACTION}" == "install" ]]; then 56 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 57 | fi 58 | rm -f "$RESOURCES_TO_COPY" 59 | 60 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n $XCASSET_FILES ] 61 | then 62 | case "${TARGETED_DEVICE_FAMILY}" in 63 | 1,2) 64 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 65 | ;; 66 | 1) 67 | TARGET_DEVICE_ARGS="--target-device iphone" 68 | ;; 69 | 2) 70 | TARGET_DEVICE_ARGS="--target-device ipad" 71 | ;; 72 | *) 73 | TARGET_DEVICE_ARGS="--target-device mac" 74 | ;; 75 | esac 76 | echo $XCASSET_FILES | xargs actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 77 | fi 78 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/ViewImageVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewImageVC.m 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/21. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) 9 | 10 | #import "ViewImageVC.h" 11 | 12 | @interface ViewImageVC () 13 | { 14 | UIViewController *_applicationTopViewController; 15 | int _previousModalPresentationStyle; 16 | UIImageView *imageView; 17 | UIScrollView *scrollview; 18 | } 19 | @end 20 | 21 | @implementation ViewImageVC 22 | -(instancetype)initWithImageView:(UIImageView *)imParam 23 | { 24 | self = [super init]; 25 | if (self) { 26 | imageView = imParam; 27 | if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) { 28 | 29 | self.modalPresentationStyle = UIModalPresentationCustom; 30 | self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 31 | self.modalPresentationCapturesStatusBarAppearance = YES; 32 | 33 | }else{ 34 | _applicationTopViewController = [self topviewController]; 35 | _previousModalPresentationStyle = _applicationTopViewController.modalPresentationStyle; 36 | _applicationTopViewController.modalPresentationStyle = UIModalPresentationCurrentContext; 37 | self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 38 | } 39 | self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 40 | } 41 | return self; 42 | } 43 | #pragma Helper method 44 | - (UIViewController *)topviewController 45 | { 46 | UIViewController *topviewController = [UIApplication sharedApplication].keyWindow.rootViewController; 47 | 48 | while (topviewController.presentedViewController) { 49 | topviewController = topviewController.presentedViewController; 50 | } 51 | 52 | return topviewController; 53 | } 54 | - (void)viewDidLoad { 55 | [super viewDidLoad]; 56 | // Do any additional setup after loading the view. 57 | scrollview = [[UIScrollView alloc]initWithFrame:self.view.bounds]; 58 | [scrollview setPagingEnabled:YES]; 59 | [scrollview setContentSize:CGSizeMake(self.view.bounds.size.width * 2, self.view.bounds.size.height)]; 60 | [self.view addSubview:scrollview]; 61 | UIScrollView *contentOne = [[UIScrollView alloc]initWithFrame:self.view.bounds]; 62 | [contentOne setDelegate:self]; 63 | [contentOne addSubview:imageView]; 64 | [contentOne setMaximumZoomScale:4.0]; 65 | UIImageView *imContentTwo = [[UIImageView alloc]initWithImage:imageView.image]; 66 | UIScrollView *contentTwo = [[UIScrollView alloc]initWithFrame:self.view.bounds]; 67 | [imContentTwo setCenter:self.view.center]; 68 | [contentTwo addSubview:imContentTwo]; 69 | [scrollview addSubview:contentOne]; 70 | [contentTwo setCenter:CGPointMake(self.view.bounds.size.width + self.view.center.x, self.view.center.y)]; 71 | [scrollview addSubview:contentTwo]; 72 | 73 | } 74 | #pragma UISrollViewDelegate 75 | - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ 76 | return imageView; 77 | } 78 | 79 | -(void)viewDidAppear:(BOOL)animated 80 | { 81 | [super viewDidAppear:animated]; 82 | [self.view setBackgroundColor:[UIColor clearColor]]; 83 | [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:1 initialSpringVelocity:7 options:UIViewAnimationOptionCurveEaseIn animations:^{ 84 | [imageView setTransform:CGAffineTransformMakeScale(1.5, 1.5)]; 85 | [imageView setCenter:self.view.center]; 86 | } completion:^(BOOL finished) { 87 | }]; 88 | 89 | } 90 | - (void)didReceiveMemoryWarning { 91 | [super didReceiveMemoryWarning]; 92 | // Dispose of any resources that can be recreated. 93 | } 94 | 95 | /* 96 | #pragma mark - Navigation 97 | 98 | // In a storyboard-based application, you will often want to do a little preparation before navigation 99 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 100 | // Get the new view controller using [segue destinationViewController]. 101 | // Pass the selected object to the new view controller. 102 | } 103 | */ 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/Base.lproj/Main.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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC.xcodeproj/xcuserdata/Ronaldinho.xcuserdatad/xcschemes/WebNewsJSBridgeOC.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /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 | #import "UIView+WebCacheOperation.h" 11 | 12 | #define UIImageViewHighlightedWebCacheOperationKey @"highlightedImage" 13 | 14 | @implementation UIImageView (HighlightedWebCache) 15 | 16 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url { 17 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 18 | } 19 | 20 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options { 21 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 22 | } 23 | 24 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock { 25 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 26 | } 27 | 28 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { 29 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 30 | } 31 | 32 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock { 33 | [self sd_cancelCurrentHighlightedImageLoad]; 34 | 35 | if (url) { 36 | __weak __typeof(self)wself = self; 37 | id operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 38 | if (!wself) return; 39 | dispatch_main_sync_safe (^ 40 | { 41 | if (!wself) return; 42 | if (image) { 43 | wself.highlightedImage = image; 44 | [wself setNeedsLayout]; 45 | } 46 | if (completedBlock && finished) { 47 | completedBlock(image, error, cacheType, url); 48 | } 49 | }); 50 | }]; 51 | [self sd_setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey]; 52 | } else { 53 | dispatch_main_async_safe(^{ 54 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 55 | if (completedBlock) { 56 | completedBlock(nil, error, SDImageCacheTypeNone, url); 57 | } 58 | }); 59 | } 60 | } 61 | 62 | - (void)sd_cancelCurrentHighlightedImageLoad { 63 | [self sd_cancelImageLoadOperationWithKey:UIImageViewHighlightedWebCacheOperationKey]; 64 | } 65 | 66 | @end 67 | 68 | 69 | @implementation UIImageView (HighlightedWebCacheDeprecated) 70 | 71 | - (void)setHighlightedImageWithURL:(NSURL *)url { 72 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 73 | } 74 | 75 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options { 76 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 77 | } 78 | 79 | - (void)setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock { 80 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 81 | if (completedBlock) { 82 | completedBlock(image, error, cacheType); 83 | } 84 | }]; 85 | } 86 | 87 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { 88 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 89 | if (completedBlock) { 90 | completedBlock(image, error, cacheType); 91 | } 92 | }]; 93 | } 94 | 95 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock { 96 | [self sd_setHighlightedImageWithURL:url options:0 progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 97 | if (completedBlock) { 98 | completedBlock(image, error, cacheType); 99 | } 100 | }]; 101 | } 102 | 103 | - (void)cancelCurrentHighlightedImageLoad { 104 | [self sd_cancelCurrentHighlightedImageLoad]; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /KYPhotoGallery/PhotoGalleryScrollView/PhotoGalleryScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoGalleryScrollView.m 3 | // KYElegantPhotoGallery-Demo 4 | // 5 | // Created by Kitten Yang on 5/31/15. 6 | // Copyright (c) 2015 Kitten Yang. All rights reserved. 7 | // 8 | 9 | #import "PhotoGalleryScrollView.h" 10 | #import "PhotoZoomScrollView.h" 11 | #import "PhotoGalleryImageView.h" 12 | #import "Macro.h" 13 | #import "KYPhotoGallery.h" 14 | 15 | 16 | @interface PhotoGalleryScrollView() 17 | 18 | @property(nonatomic,copy)void (^DidScrollBlock)(NSInteger currentIndex); 19 | @property(nonatomic,copy)void (^DidEndDecelerateBlock)(NSInteger currentIndex); 20 | @property (nonatomic,strong)KYPhotoGallery *photoGallery; 21 | 22 | @end 23 | 24 | @implementation PhotoGalleryScrollView{ 25 | NSInteger currentIndex; 26 | BOOL isFirst; 27 | } 28 | 29 | 30 | -(id)initWithFrame:(CGRect)frame imageViews:(NSMutableArray *)imageViewArray initialPageIndex:(NSInteger)initialPageIndex withPhotoGallery:(KYPhotoGallery *)photoGallery{ 31 | self = [super initWithFrame:frame]; 32 | if (self) { 33 | currentIndex = initialPageIndex; 34 | isFirst = YES; 35 | self.photoGallery = photoGallery; 36 | self.hidden = YES; 37 | self.pagingEnabled = YES; 38 | self.delegate = self; 39 | self.showsHorizontalScrollIndicator = NO; 40 | self.showsVerticalScrollIndicator = NO; 41 | self.backgroundColor = [UIColor clearColor]; 42 | [self setUp:imageViewArray frame:frame]; 43 | [self setContentOffset:CGPointMake((initialPageIndex-1)*frame.size.width, 0)]; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | -(void)dealloc{ 50 | 51 | _photos = nil; 52 | 53 | } 54 | 55 | #pragma mark -- init helper method 56 | -(void)setUp:(NSMutableArray *)imageViewArray frame:(CGRect)frame { 57 | 58 | self.photos = [NSMutableArray array]; 59 | 60 | @autoreleasepool { 61 | for (int i=0; i)scroll; 77 | image.contentMode = UIViewContentModeScaleAspectFit; 78 | 79 | image.center = CGPointMake(scroll.bounds.size.width/2,scroll.bounds.size.height/2); 80 | image.bounds = CGRectMake(0, 0, SCREENWIDTH, igv.image.size.height*SCREENWIDTH/igv.image.size.width); 81 | 82 | image.layer.masksToBounds = YES; 83 | image.layer.cornerRadius = 8.0f; 84 | [self.photos addObject:image]; 85 | scroll.currentPhoto = image; 86 | 87 | 88 | [scroll addSubview:image]; 89 | [scroll layout]; 90 | } 91 | } 92 | 93 | self.contentSize = CGSizeMake(frame.size.width * imageViewArray.count, frame.size.height); 94 | 95 | } 96 | 97 | 98 | 99 | #pragma mark -- Public method 100 | -(NSInteger)currentIndex{ 101 | return currentIndex; 102 | } 103 | 104 | -(PhotoGalleryImageView *)currentPhoto{ 105 | PhotoGalleryImageView *currentPhoto = (PhotoGalleryImageView *)[self.photos objectAtIndex:currentIndex-1]; 106 | return currentPhoto; 107 | 108 | } 109 | 110 | 111 | -(void)DidScrollBlock:(void(^)(NSInteger currentIndex))didEndScrollBlock{ 112 | 113 | self.DidScrollBlock = didEndScrollBlock; 114 | 115 | } 116 | 117 | -(void)DidEndDecelerateBlock:(void(^)(NSInteger currentIndex))didEndDeceleratBlock{ 118 | self.DidEndDecelerateBlock = didEndDeceleratBlock; 119 | } 120 | 121 | 122 | #pragma UIScrollViewDelegate method 123 | -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ 124 | 125 | if (isFirst) { 126 | isFirst = NO; 127 | }else{ 128 | currentIndex = scrollView.contentOffset.x / scrollView.bounds.size.width + 1; 129 | currentIndex = MAX(1, currentIndex); 130 | self.DidScrollBlock(currentIndex-1); 131 | } 132 | 133 | } 134 | 135 | -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ 136 | if (isFirst) { 137 | isFirst = NO; 138 | }else{ 139 | currentIndex = scrollView.contentOffset.x / scrollView.bounds.size.width + 1; 140 | currentIndex = MAX(1, currentIndex); 141 | self.DidEndDecelerateBlock(currentIndex-1); 142 | 143 | for (UIScrollView *scrollView in self.subviews) { 144 | [scrollView setZoomScale:self.minimumZoomScale animated:YES]; 145 | } 146 | } 147 | } 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | @end 157 | -------------------------------------------------------------------------------- /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 10 | #import "SDWebImageCompat.h" 11 | #import "SDWebImageManager.h" 12 | 13 | /** 14 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 15 | */ 16 | @interface UIImageView (HighlightedWebCache) 17 | 18 | /** 19 | * Set the imageView `highlightedImage` with an `url`. 20 | * 21 | * The download is asynchronous and cached. 22 | * 23 | * @param url The url for the image. 24 | */ 25 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url; 26 | 27 | /** 28 | * Set the imageView `highlightedImage` with an `url` and custom options. 29 | * 30 | * The download is asynchronous and cached. 31 | * 32 | * @param url The url for the image. 33 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 34 | */ 35 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options; 36 | 37 | /** 38 | * Set the imageView `highlightedImage` with an `url`. 39 | * 40 | * The download is asynchronous and cached. 41 | * 42 | * @param url The url for the image. 43 | * @param completedBlock A block called when operation has been completed. This block has no return value 44 | * and takes the requested UIImage as first parameter. In case of error the image parameter 45 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 46 | * indicating if the image was retrived from the local cache or from the network. 47 | * The fourth parameter is the original image url. 48 | */ 49 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock; 50 | 51 | /** 52 | * Set the imageView `highlightedImage` with an `url` and custom options. 53 | * 54 | * The download is asynchronous and cached. 55 | * 56 | * @param url The url for the image. 57 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 58 | * @param completedBlock A block called when operation has been completed. This block has no return value 59 | * and takes the requested UIImage as first parameter. In case of error the image parameter 60 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 61 | * indicating if the image was retrived from the local cache or from the network. 62 | * The fourth parameter is the original image url. 63 | */ 64 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock; 65 | 66 | /** 67 | * Set the imageView `highlightedImage` with an `url` and custom options. 68 | * 69 | * The download is asynchronous and cached. 70 | * 71 | * @param url The url for the image. 72 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 73 | * @param progressBlock A block called while image is downloading 74 | * @param completedBlock A block called when operation has been completed. This block has no return value 75 | * and takes the requested UIImage as first parameter. In case of error the image parameter 76 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 77 | * indicating if the image was retrived from the local cache or from the network. 78 | * The fourth parameter is the original image url. 79 | */ 80 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock; 81 | 82 | /** 83 | * Cancel the current download 84 | */ 85 | - (void)sd_cancelCurrentHighlightedImageLoad; 86 | 87 | @end 88 | 89 | 90 | @interface UIImageView (HighlightedWebCacheDeprecated) 91 | 92 | - (void)setHighlightedImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:`"); 93 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:`"); 94 | - (void)setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:completed:`"); 95 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:completed:`"); 96 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:progress:completed:`"); 97 | 98 | - (void)cancelCurrentHighlightedImageLoad __deprecated_msg("Use `sd_cancelCurrentHighlightedImageLoad`"); 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.m 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "UIImage+GIF.h" 10 | #import 11 | 12 | @implementation UIImage (GIF) 13 | 14 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 15 | if (!data) { 16 | return nil; 17 | } 18 | 19 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); 20 | 21 | size_t count = CGImageSourceGetCount(source); 22 | 23 | UIImage *animatedImage; 24 | 25 | if (count <= 1) { 26 | animatedImage = [[UIImage alloc] initWithData:data]; 27 | } 28 | else { 29 | NSMutableArray *images = [NSMutableArray array]; 30 | 31 | NSTimeInterval duration = 0.0f; 32 | 33 | for (size_t i = 0; i < count; i++) { 34 | CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL); 35 | 36 | duration += [self sd_frameDurationAtIndex:i source:source]; 37 | 38 | [images addObject:[UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]]; 39 | 40 | CGImageRelease(image); 41 | } 42 | 43 | if (!duration) { 44 | duration = (1.0f / 10.0f) * count; 45 | } 46 | 47 | animatedImage = [UIImage animatedImageWithImages:images duration:duration]; 48 | } 49 | 50 | CFRelease(source); 51 | 52 | return animatedImage; 53 | } 54 | 55 | + (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { 56 | float frameDuration = 0.1f; 57 | CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); 58 | NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; 59 | NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary]; 60 | 61 | NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime]; 62 | if (delayTimeUnclampedProp) { 63 | frameDuration = [delayTimeUnclampedProp floatValue]; 64 | } 65 | else { 66 | 67 | NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime]; 68 | if (delayTimeProp) { 69 | frameDuration = [delayTimeProp floatValue]; 70 | } 71 | } 72 | 73 | // Many annoying ads specify a 0 duration to make an image flash as quickly as possible. 74 | // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify 75 | // a duration of <= 10 ms. See and 76 | // for more information. 77 | 78 | if (frameDuration < 0.011f) { 79 | frameDuration = 0.100f; 80 | } 81 | 82 | CFRelease(cfFrameProperties); 83 | return frameDuration; 84 | } 85 | 86 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name { 87 | CGFloat scale = [UIScreen mainScreen].scale; 88 | 89 | if (scale > 1.0f) { 90 | NSString *retinaPath = [[NSBundle mainBundle] pathForResource:[name stringByAppendingString:@"@2x"] ofType:@"gif"]; 91 | 92 | NSData *data = [NSData dataWithContentsOfFile:retinaPath]; 93 | 94 | if (data) { 95 | return [UIImage sd_animatedGIFWithData:data]; 96 | } 97 | 98 | NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; 99 | 100 | data = [NSData dataWithContentsOfFile:path]; 101 | 102 | if (data) { 103 | return [UIImage sd_animatedGIFWithData:data]; 104 | } 105 | 106 | return [UIImage imageNamed:name]; 107 | } 108 | else { 109 | NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; 110 | 111 | NSData *data = [NSData dataWithContentsOfFile:path]; 112 | 113 | if (data) { 114 | return [UIImage sd_animatedGIFWithData:data]; 115 | } 116 | 117 | return [UIImage imageNamed:name]; 118 | } 119 | } 120 | 121 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size { 122 | if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero)) { 123 | return self; 124 | } 125 | 126 | CGSize scaledSize = size; 127 | CGPoint thumbnailPoint = CGPointZero; 128 | 129 | CGFloat widthFactor = size.width / self.size.width; 130 | CGFloat heightFactor = size.height / self.size.height; 131 | CGFloat scaleFactor = (widthFactor > heightFactor) ? widthFactor : heightFactor; 132 | scaledSize.width = self.size.width * scaleFactor; 133 | scaledSize.height = self.size.height * scaleFactor; 134 | 135 | if (widthFactor > heightFactor) { 136 | thumbnailPoint.y = (size.height - scaledSize.height) * 0.5; 137 | } 138 | else if (widthFactor < heightFactor) { 139 | thumbnailPoint.x = (size.width - scaledSize.width) * 0.5; 140 | } 141 | 142 | NSMutableArray *scaledImages = [NSMutableArray array]; 143 | 144 | UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); 145 | 146 | for (UIImage *image in self.images) { 147 | [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; 148 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 149 | 150 | [scaledImages addObject:newImage]; 151 | } 152 | 153 | UIGraphicsEndImageContext(); 154 | 155 | return [UIImage animatedImageWithImages:scaledImages duration:self.duration]; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /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 | #if (!defined(DEBUG) && !defined (SD_VERBOSE)) || defined(SD_LOG_NONE) 12 | #define NSLog(...) 13 | #endif 14 | 15 | @interface SDWebImagePrefetcher () 16 | 17 | @property (strong, nonatomic) SDWebImageManager *manager; 18 | @property (strong, nonatomic) NSArray *prefetchURLs; 19 | @property (assign, nonatomic) NSUInteger requestedCount; 20 | @property (assign, nonatomic) NSUInteger skippedCount; 21 | @property (assign, nonatomic) NSUInteger finishedCount; 22 | @property (assign, nonatomic) NSTimeInterval startedTime; 23 | @property (copy, nonatomic) SDWebImagePrefetcherCompletionBlock completionBlock; 24 | @property (copy, nonatomic) SDWebImagePrefetcherProgressBlock progressBlock; 25 | 26 | @end 27 | 28 | @implementation SDWebImagePrefetcher 29 | 30 | + (SDWebImagePrefetcher *)sharedImagePrefetcher { 31 | static dispatch_once_t once; 32 | static id instance; 33 | dispatch_once(&once, ^{ 34 | instance = [self new]; 35 | }); 36 | return instance; 37 | } 38 | 39 | - (id)init { 40 | if ((self = [super init])) { 41 | _manager = [SDWebImageManager new]; 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 downloadImageWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, 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 | NSLog(@"Prefetched %@ out of %@", @(self.finishedCount), @(self.prefetchURLs.count)); 69 | } 70 | else { 71 | if (self.progressBlock) { 72 | self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 73 | } 74 | NSLog(@"Prefetched %@ out of %@ (Failed)", @(self.finishedCount), @(self.prefetchURLs.count)); 75 | 76 | // Add last failed 77 | self.skippedCount++; 78 | } 79 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 80 | [self.delegate imagePrefetcher:self 81 | didPrefetchURL:self.prefetchURLs[index] 82 | finishedCount:self.finishedCount 83 | totalCount:self.prefetchURLs.count 84 | ]; 85 | } 86 | if (self.prefetchURLs.count > self.requestedCount) { 87 | dispatch_async(self.prefetcherQueue, ^{ 88 | [self startPrefetchingAtIndex:self.requestedCount]; 89 | }); 90 | } 91 | else if (self.finishedCount == self.requestedCount) { 92 | [self reportStatus]; 93 | if (self.completionBlock) { 94 | self.completionBlock(self.finishedCount, self.skippedCount); 95 | self.completionBlock = nil; 96 | } 97 | self.progressBlock = nil; 98 | } 99 | }]; 100 | } 101 | 102 | - (void)reportStatus { 103 | NSUInteger total = [self.prefetchURLs count]; 104 | NSLog(@"Finished prefetching (%@ successful, %@ skipped, timeElasped %.2f)", @(total - self.skippedCount), @(self.skippedCount), CFAbsoluteTimeGetCurrent() - self.startedTime); 105 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 106 | [self.delegate imagePrefetcher:self 107 | didFinishWithTotalCount:(total - self.skippedCount) 108 | skippedCount:self.skippedCount 109 | ]; 110 | } 111 | } 112 | 113 | - (void)prefetchURLs:(NSArray *)urls { 114 | [self prefetchURLs:urls progress:nil completed:nil]; 115 | } 116 | 117 | - (void)prefetchURLs:(NSArray *)urls progress:(SDWebImagePrefetcherProgressBlock)progressBlock completed:(SDWebImagePrefetcherCompletionBlock)completionBlock { 118 | [self cancelPrefetching]; // Prevent duplicate prefetch request 119 | self.startedTime = CFAbsoluteTimeGetCurrent(); 120 | self.prefetchURLs = urls; 121 | self.completionBlock = completionBlock; 122 | self.progressBlock = progressBlock; 123 | 124 | if(urls.count == 0){ 125 | if(completionBlock){ 126 | completionBlock(0,0); 127 | } 128 | }else{ 129 | // Starts prefetching from the very first image on the list with the max allowed concurrency 130 | NSUInteger listCount = self.prefetchURLs.count; 131 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 132 | [self startPrefetchingAtIndex:i]; 133 | } 134 | } 135 | } 136 | 137 | - (void)cancelPrefetching { 138 | self.prefetchURLs = nil; 139 | self.skippedCount = 0; 140 | self.requestedCount = 0; 141 | self.finishedCount = 0; 142 | [self.manager cancelAll]; 143 | } 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /WebNewsJSBridgeOC/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // WebNewsJSBridgeOC 4 | // 5 | // Created by Ronaldinho on 15/8/20. 6 | // Copyright (c) 2015年 HotWordLand. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SDWebImageManager.h" 11 | #import "WebViewJavascriptBridge.h" 12 | #import "NSString+Separate.h" 13 | #import "ViewImageVC.h" 14 | #import "KYPhotoGallery.h" 15 | #import "UIImageView+WebCache.h" 16 | @interface ViewController () 17 | { 18 | NSMutableArray *allImagesOfThisArticle; 19 | NSMutableArray *imgUrls; 20 | } 21 | @property (weak, nonatomic) IBOutlet UIWebView *webView; 22 | @property WebViewJavascriptBridge* bridge; 23 | 24 | @end 25 | 26 | @implementation ViewController 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | // Do any additional setup after loading the view, typically from a nib. 31 | /****** 加载html文件 ******/ 32 | NSString* htmlPath = [[NSBundle mainBundle] pathForResource:@"news" ofType:@"html"]; 33 | NSString* appHtml = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil]; 34 | NSURL *baseURL = [NSURL fileURLWithPath:htmlPath]; 35 | NSString *content = [appHtml stringByReplacingOccurrencesOfString:@"img src" withString:@"img esrc"]; 36 | /****** ******/ 37 | 38 | /****** 正则替换img src 成 img esrc 让网页的图片不加载出来******/ 39 | NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(]+esrc=\")(\\S+)\"" options:0 error:nil]; 40 | 41 | NSString *result = [regex stringByReplacingMatchesInString:content options:0 range:NSMakeRange(0, content.length) withTemplate:@"*)webViewDelegate handler:(WVJBHandler)messageHandler { 30 | return [self bridgeForWebView:webView webViewDelegate:webViewDelegate handler:messageHandler resourceBundle:nil]; 31 | } 32 | 33 | + (instancetype)bridgeForWebView:(WKWebView*)webView webViewDelegate:(NSObject*)webViewDelegate handler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle 34 | { 35 | WKWebViewJavascriptBridge* bridge = [[WKWebViewJavascriptBridge alloc] init]; 36 | [bridge _setupInstance:webView webViewDelegate:webViewDelegate handler:messageHandler resourceBundle:bundle]; 37 | [bridge reset]; 38 | return bridge; 39 | } 40 | 41 | - (void)send:(id)data { 42 | [self send:data responseCallback:nil]; 43 | } 44 | 45 | - (void)send:(id)data responseCallback:(WVJBResponseCallback)responseCallback { 46 | [_base sendData:data responseCallback:responseCallback handlerName:nil]; 47 | } 48 | 49 | - (void)callHandler:(NSString *)handlerName { 50 | [self callHandler:handlerName data:nil responseCallback:nil]; 51 | } 52 | 53 | - (void)callHandler:(NSString *)handlerName data:(id)data { 54 | [self callHandler:handlerName data:data responseCallback:nil]; 55 | } 56 | 57 | - (void)callHandler:(NSString *)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback { 58 | [_base sendData:data responseCallback:responseCallback handlerName:handlerName]; 59 | } 60 | 61 | - (void)registerHandler:(NSString *)handlerName handler:(WVJBHandler)handler { 62 | _base.messageHandlers[handlerName] = [handler copy]; 63 | } 64 | 65 | - (void)reset { 66 | [_base reset]; 67 | } 68 | 69 | /* Internals 70 | ***********/ 71 | 72 | - (void)dealloc { 73 | _base = nil; 74 | _webView = nil; 75 | _webViewDelegate = nil; 76 | _webView.navigationDelegate = nil; 77 | } 78 | 79 | 80 | /* WKWebView Specific Internals 81 | ******************************/ 82 | 83 | - (void) _setupInstance:(WKWebView*)webView webViewDelegate:(id)webViewDelegate handler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle{ 84 | _webView = webView; 85 | _webViewDelegate = webViewDelegate; 86 | _webView.navigationDelegate = self; 87 | _base = [[WebViewJavascriptBridgeBase alloc] initWithHandler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle]; 88 | _base.delegate = self; 89 | } 90 | 91 | 92 | - (void)WKFlushMessageQueue { 93 | [_webView evaluateJavaScript:[_base webViewJavascriptFetchQueyCommand] completionHandler:^(NSString* result, NSError* error) { 94 | [_base flushMessageQueue:result]; 95 | }]; 96 | } 97 | 98 | - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation 99 | { 100 | if (webView != _webView) { return; } 101 | 102 | _base.numRequestsLoading--; 103 | 104 | if (_base.numRequestsLoading == 0) { 105 | [webView evaluateJavaScript:[_base webViewJavascriptCheckCommand] completionHandler:^(NSString *result, NSError *error) { 106 | [_base injectJavascriptFile:![result boolValue]]; 107 | }]; 108 | } 109 | 110 | __strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate; 111 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFinishNavigation:)]) { 112 | [strongDelegate webView:webView didFinishNavigation:navigation]; 113 | } 114 | } 115 | 116 | 117 | - (void)webView:(WKWebView *)webView 118 | decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction 119 | decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { 120 | if (webView != _webView) { return; } 121 | NSURL *url = navigationAction.request.URL; 122 | __strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate; 123 | 124 | if ([_base isCorrectProcotocolScheme:url]) { 125 | if ([_base isCorrectHost:url]) { 126 | [self WKFlushMessageQueue]; 127 | } else { 128 | [_base logUnkownMessage:url]; 129 | } 130 | [webView stopLoading]; 131 | } 132 | 133 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:decisionHandler:)]) { 134 | [_webViewDelegate webView:webView decidePolicyForNavigationAction:navigationAction decisionHandler:decisionHandler]; 135 | } else { 136 | decisionHandler(WKNavigationActionPolicyAllow); 137 | } 138 | } 139 | 140 | - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { 141 | if (webView != _webView) { return; } 142 | 143 | _base.numRequestsLoading++; 144 | 145 | __strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate; 146 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didStartProvisionalNavigation:)]) { 147 | [strongDelegate webView:webView didStartProvisionalNavigation:navigation]; 148 | } 149 | } 150 | 151 | 152 | - (void)webView:(WKWebView *)webView 153 | didFailNavigation:(WKNavigation *)navigation 154 | withError:(NSError *)error { 155 | if (webView != _webView) { return; } 156 | 157 | _base.numRequestsLoading--; 158 | 159 | __strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate; 160 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFailNavigation:withError:)]) { 161 | [strongDelegate webView:webView didFailNavigation:navigation withError:error]; 162 | } 163 | } 164 | 165 | - (NSString*) _evaluateJavascript:(NSString*)javascriptCommand 166 | { 167 | [_webView evaluateJavaScript:javascriptCommand completionHandler:nil]; 168 | return NULL; 169 | } 170 | 171 | 172 | 173 | @end 174 | 175 | 176 | #endif 177 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloader.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 | #import "SDWebImageOperation.h" 12 | 13 | typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) { 14 | SDWebImageDownloaderLowPriority = 1 << 0, 15 | SDWebImageDownloaderProgressiveDownload = 1 << 1, 16 | 17 | /** 18 | * By default, request prevent the of NSURLCache. With this flag, NSURLCache 19 | * is used with default policies. 20 | */ 21 | SDWebImageDownloaderUseNSURLCache = 1 << 2, 22 | 23 | /** 24 | * Call completion block with nil image/imageData if the image was read from NSURLCache 25 | * (to be combined with `SDWebImageDownloaderUseNSURLCache`). 26 | */ 27 | 28 | SDWebImageDownloaderIgnoreCachedResponse = 1 << 3, 29 | /** 30 | * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for 31 | * extra time in background to let the request finish. If the background task expires the operation will be cancelled. 32 | */ 33 | 34 | SDWebImageDownloaderContinueInBackground = 1 << 4, 35 | 36 | /** 37 | * Handles cookies stored in NSHTTPCookieStore by setting 38 | * NSMutableURLRequest.HTTPShouldHandleCookies = YES; 39 | */ 40 | SDWebImageDownloaderHandleCookies = 1 << 5, 41 | 42 | /** 43 | * Enable to allow untrusted SSL ceriticates. 44 | * Useful for testing purposes. Use with caution in production. 45 | */ 46 | SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6, 47 | 48 | /** 49 | * Put the image in the high priority queue. 50 | */ 51 | SDWebImageDownloaderHighPriority = 1 << 7, 52 | }; 53 | 54 | typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { 55 | /** 56 | * Default value. All download operations will execute in queue style (first-in-first-out). 57 | */ 58 | SDWebImageDownloaderFIFOExecutionOrder, 59 | 60 | /** 61 | * All download operations will execute in stack style (last-in-first-out). 62 | */ 63 | SDWebImageDownloaderLIFOExecutionOrder 64 | }; 65 | 66 | extern NSString *const SDWebImageDownloadStartNotification; 67 | extern NSString *const SDWebImageDownloadStopNotification; 68 | 69 | typedef void(^SDWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize); 70 | 71 | typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage *image, NSData *data, NSError *error, BOOL finished); 72 | 73 | typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDictionary *headers); 74 | 75 | /** 76 | * Asynchronous downloader dedicated and optimized for image loading. 77 | */ 78 | @interface SDWebImageDownloader : NSObject 79 | 80 | /** 81 | * Decompressing images that are downloaded and cached can improve peformance but can consume lot of memory. 82 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 83 | */ 84 | @property (assign, nonatomic) BOOL shouldDecompressImages; 85 | 86 | @property (assign, nonatomic) NSInteger maxConcurrentDownloads; 87 | 88 | /** 89 | * Shows the current amount of downloads that still need to be downloaded 90 | */ 91 | @property (readonly, nonatomic) NSUInteger currentDownloadCount; 92 | 93 | 94 | /** 95 | * The timeout value (in seconds) for the download operation. Default: 15.0. 96 | */ 97 | @property (assign, nonatomic) NSTimeInterval downloadTimeout; 98 | 99 | 100 | /** 101 | * Changes download operations execution order. Default value is `SDWebImageDownloaderFIFOExecutionOrder`. 102 | */ 103 | @property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder; 104 | 105 | /** 106 | * Singleton method, returns the shared instance 107 | * 108 | * @return global shared instance of downloader class 109 | */ 110 | + (SDWebImageDownloader *)sharedDownloader; 111 | 112 | /** 113 | * Set username 114 | */ 115 | @property (strong, nonatomic) NSString *username; 116 | 117 | /** 118 | * Set password 119 | */ 120 | @property (strong, nonatomic) NSString *password; 121 | 122 | /** 123 | * Set filter to pick headers for downloading image HTTP request. 124 | * 125 | * This block will be invoked for each downloading image request, returned 126 | * NSDictionary will be used as headers in corresponding HTTP request. 127 | */ 128 | @property (nonatomic, copy) SDWebImageDownloaderHeadersFilterBlock headersFilter; 129 | 130 | /** 131 | * Set a value for a HTTP header to be appended to each download HTTP request. 132 | * 133 | * @param value The value for the header field. Use `nil` value to remove the header. 134 | * @param field The name of the header field to set. 135 | */ 136 | - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field; 137 | 138 | /** 139 | * Returns the value of the specified HTTP header field. 140 | * 141 | * @return The value associated with the header field field, or `nil` if there is no corresponding header field. 142 | */ 143 | - (NSString *)valueForHTTPHeaderField:(NSString *)field; 144 | 145 | /** 146 | * Sets a subclass of `SDWebImageDownloaderOperation` as the default 147 | * `NSOperation` to be used each time SDWebImage constructs a request 148 | * operation to download an image. 149 | * 150 | * @param operationClass The subclass of `SDWebImageDownloaderOperation` to set 151 | * as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. 152 | */ 153 | - (void)setOperationClass:(Class)operationClass; 154 | 155 | /** 156 | * Creates a SDWebImageDownloader async downloader instance with a given URL 157 | * 158 | * The delegate will be informed when the image is finish downloaded or an error has happen. 159 | * 160 | * @see SDWebImageDownloaderDelegate 161 | * 162 | * @param url The URL to the image to download 163 | * @param options The options to be used for this download 164 | * @param progressBlock A block called repeatedly while the image is downloading 165 | * @param completedBlock A block called once the download is completed. 166 | * If the download succeeded, the image parameter is set, in case of error, 167 | * error parameter is set with the error. The last parameter is always YES 168 | * if SDWebImageDownloaderProgressiveDownload isn't use. With the 169 | * SDWebImageDownloaderProgressiveDownload option, this block is called 170 | * repeatedly with the partial image object and the finished argument set to NO 171 | * before to be called a last time with the full image and finished argument 172 | * set to YES. In case of error, the finished argument is always YES. 173 | * 174 | * @return A cancellable SDWebImageOperation 175 | */ 176 | - (id )downloadImageWithURL:(NSURL *)url 177 | options:(SDWebImageDownloaderOptions)options 178 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 179 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock; 180 | 181 | /** 182 | * Sets the download queue suspension state 183 | */ 184 | - (void)setSuspended:(BOOL)suspended; 185 | 186 | @end 187 | -------------------------------------------------------------------------------- /WebViewJavascriptBridge/WebViewJavascriptBridgeBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewJavascriptBridgeBase.m 3 | // 4 | // Created by @LokiMeyburg on 10/15/14. 5 | // Copyright (c) 2014 @LokiMeyburg. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "WebViewJavascriptBridgeBase.h" 10 | 11 | @implementation WebViewJavascriptBridgeBase { 12 | id _webViewDelegate; 13 | long _uniqueId; 14 | NSBundle *_resourceBundle; 15 | } 16 | 17 | static bool logging = false; 18 | 19 | + (void)enableLogging { logging = true; } 20 | 21 | -(id)initWithHandler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle 22 | { 23 | self = [super init]; 24 | _resourceBundle = bundle; 25 | self.messageHandler = messageHandler; 26 | self.messageHandlers = [NSMutableDictionary dictionary]; 27 | self.startupMessageQueue = [NSMutableArray array]; 28 | self.responseCallbacks = [NSMutableDictionary dictionary]; 29 | _uniqueId = 0; 30 | return(self); 31 | } 32 | 33 | - (void)dealloc { 34 | self.startupMessageQueue = nil; 35 | self.responseCallbacks = nil; 36 | self.messageHandlers = nil; 37 | self.messageHandler = nil; 38 | } 39 | 40 | - (void)reset { 41 | self.startupMessageQueue = [NSMutableArray array]; 42 | self.responseCallbacks = [NSMutableDictionary dictionary]; 43 | _uniqueId = 0; 44 | } 45 | 46 | - (void)sendData:(id)data responseCallback:(WVJBResponseCallback)responseCallback handlerName:(NSString*)handlerName { 47 | NSMutableDictionary* message = [NSMutableDictionary dictionary]; 48 | 49 | if (data) { 50 | message[@"data"] = data; 51 | } 52 | 53 | if (responseCallback) { 54 | NSString* callbackId = [NSString stringWithFormat:@"objc_cb_%ld", ++_uniqueId]; 55 | self.responseCallbacks[callbackId] = [responseCallback copy]; 56 | message[@"callbackId"] = callbackId; 57 | } 58 | 59 | if (handlerName) { 60 | message[@"handlerName"] = handlerName; 61 | } 62 | [self _queueMessage:message]; 63 | } 64 | 65 | - (void)flushMessageQueue:(NSString *)messageQueueString{ 66 | id messages = [self _deserializeMessageJSON:messageQueueString]; 67 | if (![messages isKindOfClass:[NSArray class]]) { 68 | NSLog(@"WebViewJavascriptBridge: WARNING: Invalid %@ received: %@", [messages class], messages); 69 | return; 70 | } 71 | for (WVJBMessage* message in messages) { 72 | if (![message isKindOfClass:[WVJBMessage class]]) { 73 | NSLog(@"WebViewJavascriptBridge: WARNING: Invalid %@ received: %@", [message class], message); 74 | continue; 75 | } 76 | [self _log:@"RCVD" json:message]; 77 | 78 | NSString* responseId = message[@"responseId"]; 79 | if (responseId) { 80 | WVJBResponseCallback responseCallback = _responseCallbacks[responseId]; 81 | responseCallback(message[@"responseData"]); 82 | [self.responseCallbacks removeObjectForKey:responseId]; 83 | } else { 84 | WVJBResponseCallback responseCallback = NULL; 85 | NSString* callbackId = message[@"callbackId"]; 86 | if (callbackId) { 87 | responseCallback = ^(id responseData) { 88 | if (responseData == nil) { 89 | responseData = [NSNull null]; 90 | } 91 | 92 | WVJBMessage* msg = @{ @"responseId":callbackId, @"responseData":responseData }; 93 | [self _queueMessage:msg]; 94 | }; 95 | } else { 96 | responseCallback = ^(id ignoreResponseData) { 97 | // Do nothing 98 | }; 99 | } 100 | 101 | WVJBHandler handler; 102 | if (message[@"handlerName"]) { 103 | handler = self.messageHandlers[message[@"handlerName"]]; 104 | } else { 105 | handler = self.messageHandler; 106 | } 107 | 108 | if (!handler) { 109 | [NSException raise:@"WVJBNoHandlerException" format:@"No handler for message from JS: %@", message]; 110 | } 111 | 112 | handler(message[@"data"], responseCallback); 113 | } 114 | } 115 | } 116 | 117 | - (void)injectJavascriptFile:(BOOL)shouldInject { 118 | if(shouldInject){ 119 | NSBundle *bundle = _resourceBundle ? _resourceBundle : [NSBundle mainBundle]; 120 | NSString *filePath = [bundle pathForResource:@"WebViewJavascriptBridge.js" ofType:@"txt"]; 121 | NSString *js = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; 122 | [self _evaluateJavascript:js]; 123 | [self dispatchStartUpMessageQueue]; 124 | } 125 | 126 | } 127 | 128 | - (void)dispatchStartUpMessageQueue { 129 | if (self.startupMessageQueue) { 130 | for (id queuedMessage in self.startupMessageQueue) { 131 | [self _dispatchMessage:queuedMessage]; 132 | } 133 | self.startupMessageQueue = nil; 134 | } 135 | } 136 | 137 | -(BOOL)isCorrectProcotocolScheme:(NSURL*)url { 138 | if([[url scheme] isEqualToString:kCustomProtocolScheme]){ 139 | return YES; 140 | } else { 141 | return NO; 142 | } 143 | } 144 | 145 | -(BOOL)isCorrectHost:(NSURL*)url { 146 | if([[url host] isEqualToString:kQueueHasMessage]){ 147 | return YES; 148 | } else { 149 | return NO; 150 | } 151 | } 152 | 153 | -(void)logUnkownMessage:(NSURL*)url { 154 | NSLog(@"WebViewJavascriptBridge: WARNING: Received unknown WebViewJavascriptBridge command %@://%@", kCustomProtocolScheme, [url path]); 155 | } 156 | 157 | -(NSString *)webViewJavascriptCheckCommand { 158 | return @"typeof WebViewJavascriptBridge == \'object\';"; 159 | } 160 | 161 | -(NSString *)webViewJavascriptFetchQueyCommand { 162 | return @"WebViewJavascriptBridge._fetchQueue();"; 163 | } 164 | 165 | // Private 166 | // ------------------------------------------- 167 | 168 | - (void) _evaluateJavascript:(NSString *)javascriptCommand { 169 | [self.delegate _evaluateJavascript:javascriptCommand]; 170 | } 171 | 172 | - (void)_queueMessage:(WVJBMessage*)message { 173 | if (self.startupMessageQueue) { 174 | [self.startupMessageQueue addObject:message]; 175 | } else { 176 | [self _dispatchMessage:message]; 177 | } 178 | } 179 | 180 | - (void)_dispatchMessage:(WVJBMessage*)message { 181 | NSString *messageJSON = [self _serializeMessage:message]; 182 | [self _log:@"SEND" json:messageJSON]; 183 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]; 184 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]; 185 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\'" withString:@"\\\'"]; 186 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]; 187 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\r" withString:@"\\r"]; 188 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\f" withString:@"\\f"]; 189 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\u2028" withString:@"\\u2028"]; 190 | messageJSON = [messageJSON stringByReplacingOccurrencesOfString:@"\u2029" withString:@"\\u2029"]; 191 | 192 | NSString* javascriptCommand = [NSString stringWithFormat:@"WebViewJavascriptBridge._handleMessageFromObjC('%@');", messageJSON]; 193 | if ([[NSThread currentThread] isMainThread]) { 194 | [self _evaluateJavascript:javascriptCommand]; 195 | 196 | } else { 197 | dispatch_sync(dispatch_get_main_queue(), ^{ 198 | [self _evaluateJavascript:javascriptCommand]; 199 | }); 200 | } 201 | } 202 | 203 | - (NSString *)_serializeMessage:(id)message { 204 | return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:message options:0 error:nil] encoding:NSUTF8StringEncoding]; 205 | } 206 | 207 | - (NSArray*)_deserializeMessageJSON:(NSString *)messageJSON { 208 | return [NSJSONSerialization JSONObjectWithData:[messageJSON dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; 209 | } 210 | 211 | - (void)_log:(NSString *)action json:(id)json { 212 | if (!logging) { return; } 213 | if (![json isKindOfClass:[NSString class]]) { 214 | json = [self _serializeMessage:json]; 215 | } 216 | if ([json length] > 500) { 217 | NSLog(@"WVJB %@: %@ [...]", action, [json substringToIndex:500]); 218 | } else { 219 | NSLog(@"WVJB %@: %@", action, json); 220 | } 221 | } 222 | 223 | @end -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCache.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 | typedef NS_ENUM(NSInteger, SDImageCacheType) { 13 | /** 14 | * The image wasn't available the SDWebImage caches, but was downloaded from the web. 15 | */ 16 | SDImageCacheTypeNone, 17 | /** 18 | * The image was obtained from the disk cache. 19 | */ 20 | SDImageCacheTypeDisk, 21 | /** 22 | * The image was obtained from the memory cache. 23 | */ 24 | SDImageCacheTypeMemory 25 | }; 26 | 27 | typedef void(^SDWebImageQueryCompletedBlock)(UIImage *image, SDImageCacheType cacheType); 28 | 29 | typedef void(^SDWebImageCheckCacheCompletionBlock)(BOOL isInCache); 30 | 31 | typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger totalSize); 32 | 33 | /** 34 | * SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed 35 | * asynchronous so it doesn’t add unnecessary latency to the UI. 36 | */ 37 | @interface SDImageCache : NSObject 38 | 39 | /** 40 | * Decompressing images that are downloaded and cached can improve peformance but can consume lot of memory. 41 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 42 | */ 43 | @property (assign, nonatomic) BOOL shouldDecompressImages; 44 | 45 | /** 46 | * The maximum "total cost" of the in-memory image cache. The cost function is the number of pixels held in memory. 47 | */ 48 | @property (assign, nonatomic) NSUInteger maxMemoryCost; 49 | 50 | /** 51 | * The maximum number of objects the cache should hold. 52 | */ 53 | @property (assign, nonatomic) NSUInteger maxMemoryCountLimit; 54 | 55 | /** 56 | * The maximum length of time to keep an image in the cache, in seconds 57 | */ 58 | @property (assign, nonatomic) NSInteger maxCacheAge; 59 | 60 | /** 61 | * The maximum size of the cache, in bytes. 62 | */ 63 | @property (assign, nonatomic) NSUInteger maxCacheSize; 64 | 65 | /** 66 | * Returns global shared cache instance 67 | * 68 | * @return SDImageCache global instance 69 | */ 70 | + (SDImageCache *)sharedImageCache; 71 | 72 | /** 73 | * Init a new cache store with a specific namespace 74 | * 75 | * @param ns The namespace to use for this cache store 76 | */ 77 | - (id)initWithNamespace:(NSString *)ns; 78 | 79 | /** 80 | * Init a new cache store with a specific namespace and directory 81 | * 82 | * @param ns The namespace to use for this cache store 83 | * @param directory Directory to cache disk images in 84 | */ 85 | - (id)initWithNamespace:(NSString *)ns diskCacheDirectory:(NSString *)directory; 86 | 87 | -(NSString *)makeDiskCachePath:(NSString*)fullNamespace; 88 | 89 | /** 90 | * Add a read-only cache path to search for images pre-cached by SDImageCache 91 | * Useful if you want to bundle pre-loaded images with your app 92 | * 93 | * @param path The path to use for this read-only cache path 94 | */ 95 | - (void)addReadOnlyCachePath:(NSString *)path; 96 | 97 | /** 98 | * Store an image into memory and disk cache at the given key. 99 | * 100 | * @param image The image to store 101 | * @param key The unique image cache key, usually it's image absolute URL 102 | */ 103 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key; 104 | 105 | /** 106 | * Store an image into memory and optionally disk cache at the given key. 107 | * 108 | * @param image The image to store 109 | * @param key The unique image cache key, usually it's image absolute URL 110 | * @param toDisk Store the image to disk cache if YES 111 | */ 112 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk; 113 | 114 | /** 115 | * Store an image into memory and optionally disk cache at the given key. 116 | * 117 | * @param image The image to store 118 | * @param recalculate BOOL indicates if imageData can be used or a new data should be constructed from the UIImage 119 | * @param imageData The image data as returned by the server, this representation will be used for disk storage 120 | * instead of converting the given image object into a storable/compressed image format in order 121 | * to save quality and CPU 122 | * @param key The unique image cache key, usually it's image absolute URL 123 | * @param toDisk Store the image to disk cache if YES 124 | */ 125 | - (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk; 126 | 127 | /** 128 | * Query the disk cache asynchronously. 129 | * 130 | * @param key The unique key used to store the wanted image 131 | */ 132 | - (NSOperation *)queryDiskCacheForKey:(NSString *)key done:(SDWebImageQueryCompletedBlock)doneBlock; 133 | 134 | /** 135 | * Query the memory cache synchronously. 136 | * 137 | * @param key The unique key used to store the wanted image 138 | */ 139 | - (UIImage *)imageFromMemoryCacheForKey:(NSString *)key; 140 | 141 | /** 142 | * Query the disk cache synchronously after checking the memory cache. 143 | * 144 | * @param key The unique key used to store the wanted image 145 | */ 146 | - (UIImage *)imageFromDiskCacheForKey:(NSString *)key; 147 | 148 | /** 149 | * Remove the image from memory and disk cache synchronously 150 | * 151 | * @param key The unique image cache key 152 | */ 153 | - (void)removeImageForKey:(NSString *)key; 154 | 155 | 156 | /** 157 | * Remove the image from memory and disk cache asynchronously 158 | * 159 | * @param key The unique image cache key 160 | * @param completion An block that should be executed after the image has been removed (optional) 161 | */ 162 | - (void)removeImageForKey:(NSString *)key withCompletion:(SDWebImageNoParamsBlock)completion; 163 | 164 | /** 165 | * Remove the image from memory and optionally disk cache asynchronously 166 | * 167 | * @param key The unique image cache key 168 | * @param fromDisk Also remove cache entry from disk if YES 169 | */ 170 | - (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk; 171 | 172 | /** 173 | * Remove the image from memory and optionally disk cache asynchronously 174 | * 175 | * @param key The unique image cache key 176 | * @param fromDisk Also remove cache entry from disk if YES 177 | * @param completion An block that should be executed after the image has been removed (optional) 178 | */ 179 | - (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(SDWebImageNoParamsBlock)completion; 180 | 181 | /** 182 | * Clear all memory cached images 183 | */ 184 | - (void)clearMemory; 185 | 186 | /** 187 | * Clear all disk cached images. Non-blocking method - returns immediately. 188 | * @param completion An block that should be executed after cache expiration completes (optional) 189 | */ 190 | - (void)clearDiskOnCompletion:(SDWebImageNoParamsBlock)completion; 191 | 192 | /** 193 | * Clear all disk cached images 194 | * @see clearDiskOnCompletion: 195 | */ 196 | - (void)clearDisk; 197 | 198 | /** 199 | * Remove all expired cached image from disk. Non-blocking method - returns immediately. 200 | * @param completionBlock An block that should be executed after cache expiration completes (optional) 201 | */ 202 | - (void)cleanDiskWithCompletionBlock:(SDWebImageNoParamsBlock)completionBlock; 203 | 204 | /** 205 | * Remove all expired cached image from disk 206 | * @see cleanDiskWithCompletionBlock: 207 | */ 208 | - (void)cleanDisk; 209 | 210 | /** 211 | * Get the size used by the disk cache 212 | */ 213 | - (NSUInteger)getSize; 214 | 215 | /** 216 | * Get the number of images in the disk cache 217 | */ 218 | - (NSUInteger)getDiskCount; 219 | 220 | /** 221 | * Asynchronously calculate the disk cache's size. 222 | */ 223 | - (void)calculateSizeWithCompletionBlock:(SDWebImageCalculateSizeBlock)completionBlock; 224 | 225 | /** 226 | * Async check if image exists in disk cache already (does not load the image) 227 | * 228 | * @param key the key describing the url 229 | * @param completionBlock the block to be executed when the check is done. 230 | * @note the completion block will be always executed on the main queue 231 | */ 232 | - (void)diskImageExistsWithKey:(NSString *)key completion:(SDWebImageCheckCacheCompletionBlock)completionBlock; 233 | 234 | /** 235 | * Check if image exists in disk cache already (does not load the image) 236 | * 237 | * @param key the key describing the url 238 | * 239 | * @return YES if an image exists for the given key 240 | */ 241 | - (BOOL)diskImageExistsWithKey:(NSString *)key; 242 | 243 | /** 244 | * Get the cache path for a certain key (needs the cache path root folder) 245 | * 246 | * @param key the key (can be obtained from url using cacheKeyForURL) 247 | * @param path the cach path root folder 248 | * 249 | * @return the cache path 250 | */ 251 | - (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path; 252 | 253 | /** 254 | * Get the default cache path for a certain key 255 | * 256 | * @param key the key (can be obtained from url using cacheKeyForURL) 257 | * 258 | * @return the default cache path 259 | */ 260 | - (NSString *)defaultCachePathForKey:(NSString *)key; 261 | 262 | @end 263 | -------------------------------------------------------------------------------- /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 | #import "objc/runtime.h" 11 | #import "UIView+WebCacheOperation.h" 12 | 13 | static char imageURLKey; 14 | 15 | @implementation UIImageView (WebCache) 16 | 17 | - (void)sd_setImageWithURL:(NSURL *)url { 18 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 19 | } 20 | 21 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder { 22 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 23 | } 24 | 25 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options { 26 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 27 | } 28 | 29 | - (void)sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock { 30 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 31 | } 32 | 33 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock { 34 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 35 | } 36 | 37 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { 38 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 39 | } 40 | 41 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock { 42 | [self sd_cancelCurrentImageLoad]; 43 | objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 44 | 45 | if (!(options & SDWebImageDelayPlaceholder)) { 46 | dispatch_main_async_safe(^{ 47 | self.image = placeholder; 48 | }); 49 | } 50 | 51 | if (url) { 52 | __weak __typeof(self)wself = self; 53 | id operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 54 | if (!wself) return; 55 | dispatch_main_sync_safe(^{ 56 | if (!wself) return; 57 | if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) 58 | { 59 | completedBlock(image, error, cacheType, url); 60 | return; 61 | } 62 | else if (image) { 63 | wself.image = image; 64 | [wself setNeedsLayout]; 65 | } else { 66 | if ((options & SDWebImageDelayPlaceholder)) { 67 | wself.image = placeholder; 68 | [wself setNeedsLayout]; 69 | } 70 | } 71 | if (completedBlock && finished) { 72 | completedBlock(image, error, cacheType, url); 73 | } 74 | }); 75 | }]; 76 | [self sd_setImageLoadOperation:operation forKey:@"UIImageViewImageLoad"]; 77 | } else { 78 | dispatch_main_async_safe(^{ 79 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 80 | if (completedBlock) { 81 | completedBlock(nil, error, SDImageCacheTypeNone, url); 82 | } 83 | }); 84 | } 85 | } 86 | 87 | - (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock { 88 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url]; 89 | UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:key]; 90 | 91 | [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock]; 92 | } 93 | 94 | - (NSURL *)sd_imageURL { 95 | return objc_getAssociatedObject(self, &imageURLKey); 96 | } 97 | 98 | - (void)sd_setAnimationImagesWithURLs:(NSArray *)arrayOfURLs { 99 | [self sd_cancelCurrentAnimationImagesLoad]; 100 | __weak __typeof(self)wself = self; 101 | 102 | NSMutableArray *operationsArray = [[NSMutableArray alloc] init]; 103 | 104 | for (NSURL *logoImageURL in arrayOfURLs) { 105 | id operation = [SDWebImageManager.sharedManager downloadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 106 | if (!wself) return; 107 | dispatch_main_sync_safe(^{ 108 | __strong UIImageView *sself = wself; 109 | [sself stopAnimating]; 110 | if (sself && image) { 111 | NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; 112 | if (!currentImages) { 113 | currentImages = [[NSMutableArray alloc] init]; 114 | } 115 | [currentImages addObject:image]; 116 | 117 | sself.animationImages = currentImages; 118 | [sself setNeedsLayout]; 119 | } 120 | [sself startAnimating]; 121 | }); 122 | }]; 123 | [operationsArray addObject:operation]; 124 | } 125 | 126 | [self sd_setImageLoadOperation:[NSArray arrayWithArray:operationsArray] forKey:@"UIImageViewAnimationImages"]; 127 | } 128 | 129 | - (void)sd_cancelCurrentImageLoad { 130 | [self sd_cancelImageLoadOperationWithKey:@"UIImageViewImageLoad"]; 131 | } 132 | 133 | - (void)sd_cancelCurrentAnimationImagesLoad { 134 | [self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"]; 135 | } 136 | 137 | @end 138 | 139 | 140 | @implementation UIImageView (WebCacheDeprecated) 141 | 142 | - (NSURL *)imageURL { 143 | return [self sd_imageURL]; 144 | } 145 | 146 | - (void)setImageWithURL:(NSURL *)url { 147 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 148 | } 149 | 150 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder { 151 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 152 | } 153 | 154 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options { 155 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 156 | } 157 | 158 | - (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock { 159 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 160 | if (completedBlock) { 161 | completedBlock(image, error, cacheType); 162 | } 163 | }]; 164 | } 165 | 166 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock { 167 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 168 | if (completedBlock) { 169 | completedBlock(image, error, cacheType); 170 | } 171 | }]; 172 | } 173 | 174 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { 175 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 176 | if (completedBlock) { 177 | completedBlock(image, error, cacheType); 178 | } 179 | }]; 180 | } 181 | 182 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock { 183 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 184 | if (completedBlock) { 185 | completedBlock(image, error, cacheType); 186 | } 187 | }]; 188 | } 189 | 190 | - (void)cancelCurrentArrayLoad { 191 | [self sd_cancelCurrentAnimationImagesLoad]; 192 | } 193 | 194 | - (void)cancelCurrentImageLoad { 195 | [self sd_cancelCurrentImageLoad]; 196 | } 197 | 198 | - (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs { 199 | [self sd_setAnimationImagesWithURLs:arrayOfURLs]; 200 | } 201 | 202 | @end 203 | -------------------------------------------------------------------------------- /WebViewJavascriptBridge/WebViewJavascriptBridge.m: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewJavascriptBridge.m 3 | // ExampleApp-iOS 4 | // 5 | // Created by Marcus Westin on 6/14/13. 6 | // Copyright (c) 2013 Marcus Westin. All rights reserved. 7 | // 8 | 9 | #import "WebViewJavascriptBridge.h" 10 | 11 | #if __has_feature(objc_arc_weak) 12 | #define WVJB_WEAK __weak 13 | #else 14 | #define WVJB_WEAK __unsafe_unretained 15 | #endif 16 | 17 | @implementation WebViewJavascriptBridge { 18 | WVJB_WEAK WVJB_WEBVIEW_TYPE* _webView; 19 | WVJB_WEAK id _webViewDelegate; 20 | long _uniqueId; 21 | WebViewJavascriptBridgeBase *_base; 22 | #if defined WVJB_PLATFORM_IOS 23 | NSUInteger _numRequestsLoading; 24 | #endif 25 | 26 | } 27 | 28 | /* API 29 | *****/ 30 | 31 | + (void)enableLogging { [WebViewJavascriptBridgeBase enableLogging]; } 32 | 33 | + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView handler:(WVJBHandler)handler { 34 | return [self bridgeForWebView:webView webViewDelegate:nil handler:handler]; 35 | } 36 | 37 | + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WVJB_WEBVIEW_DELEGATE_TYPE*)webViewDelegate handler:(WVJBHandler)messageHandler { 38 | return [self bridgeForWebView:webView webViewDelegate:webViewDelegate handler:messageHandler resourceBundle:nil]; 39 | } 40 | 41 | + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WVJB_WEBVIEW_DELEGATE_TYPE*)webViewDelegate handler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle 42 | { 43 | WebViewJavascriptBridge* bridge = [[WebViewJavascriptBridge alloc] init]; 44 | [bridge _platformSpecificSetup:webView webViewDelegate:webViewDelegate handler:messageHandler resourceBundle:bundle]; 45 | return bridge; 46 | } 47 | 48 | - (void)send:(id)data { 49 | [self send:data responseCallback:nil]; 50 | } 51 | 52 | - (void)send:(id)data responseCallback:(WVJBResponseCallback)responseCallback { 53 | [_base sendData:data responseCallback:responseCallback handlerName:nil]; 54 | } 55 | 56 | - (void)callHandler:(NSString *)handlerName { 57 | [self callHandler:handlerName data:nil responseCallback:nil]; 58 | } 59 | 60 | - (void)callHandler:(NSString *)handlerName data:(id)data { 61 | [self callHandler:handlerName data:data responseCallback:nil]; 62 | } 63 | 64 | - (void)callHandler:(NSString *)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback { 65 | [_base sendData:data responseCallback:responseCallback handlerName:handlerName]; 66 | } 67 | 68 | - (void)registerHandler:(NSString *)handlerName handler:(WVJBHandler)handler { 69 | _base.messageHandlers[handlerName] = [handler copy]; 70 | } 71 | 72 | /* Platform agnostic internals 73 | *****************************/ 74 | 75 | - (void)dealloc { 76 | [self _platformSpecificDealloc]; 77 | _base = nil; 78 | _webView = nil; 79 | _webViewDelegate = nil; 80 | } 81 | 82 | - (NSString*) _evaluateJavascript:(NSString*)javascriptCommand 83 | { 84 | return [_webView stringByEvaluatingJavaScriptFromString:javascriptCommand]; 85 | } 86 | 87 | /* Platform specific internals: OSX 88 | **********************************/ 89 | #if defined WVJB_PLATFORM_OSX 90 | 91 | - (void) _platformSpecificSetup:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WVJB_WEBVIEW_DELEGATE_TYPE*)webViewDelegate handler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle{ 92 | _webView = webView; 93 | _webViewDelegate = webViewDelegate; 94 | 95 | _webView.frameLoadDelegate = self; 96 | _webView.resourceLoadDelegate = self; 97 | _webView.policyDelegate = self; 98 | 99 | _base = [[WebViewJavascriptBridgeBase alloc] initWithHandler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle]; 100 | _base.delegate = self; 101 | } 102 | 103 | - (void) _platformSpecificDealloc { 104 | _webView.frameLoadDelegate = nil; 105 | _webView.resourceLoadDelegate = nil; 106 | _webView.policyDelegate = nil; 107 | } 108 | 109 | - (void)webView:(WebView *)webView didFinishLoadForFrame:(WebFrame *)frame 110 | { 111 | if (webView != _webView) { return; } 112 | 113 | if (![[webView stringByEvaluatingJavaScriptFromString:[_base webViewJavascriptCheckCommand]] isEqualToString:@"true"]) { 114 | [_base injectJavascriptFile:YES]; 115 | } 116 | 117 | [_base dispatchStartUpMessageQueue]; 118 | 119 | if (_webViewDelegate && [_webViewDelegate respondsToSelector:@selector(webView:didFinishLoadForFrame:)]) { 120 | [_webViewDelegate webView:webView didFinishLoadForFrame:frame]; 121 | } 122 | } 123 | 124 | - (void)webView:(WebView *)webView didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { 125 | if (webView != _webView) { return; } 126 | 127 | if (_webViewDelegate && [_webViewDelegate respondsToSelector:@selector(webView:didFailLoadWithError:forFrame:)]) { 128 | [_webViewDelegate webView:webView didFailLoadWithError:error forFrame:frame]; 129 | } 130 | } 131 | 132 | - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id)listener 133 | { 134 | if (webView != _webView) { return; } 135 | 136 | NSURL *url = [request URL]; 137 | if ([_base isCorrectProcotocolScheme:url]) { 138 | if ([_base isCorrectHost:url]) { 139 | NSString *messageQueueString = [self _evaluateJavascript:[_base webViewJavascriptFetchQueyCommand]]; 140 | [_base flushMessageQueue:messageQueueString]; 141 | } else { 142 | [_base logUnkownMessage:url]; 143 | } 144 | [listener ignore]; 145 | } else if (_webViewDelegate && [_webViewDelegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:request:frame:decisionListener:)]) { 146 | [_webViewDelegate webView:webView decidePolicyForNavigationAction:actionInformation request:request frame:frame decisionListener:listener]; 147 | } else { 148 | [listener use]; 149 | } 150 | } 151 | 152 | - (void)webView:(WebView *)webView didCommitLoadForFrame:(WebFrame *)frame { 153 | if (webView != _webView) { return; } 154 | 155 | if (_webViewDelegate && [_webViewDelegate respondsToSelector:@selector(webView:didCommitLoadForFrame:)]) { 156 | [_webViewDelegate webView:webView didCommitLoadForFrame:frame]; 157 | } 158 | } 159 | 160 | - (NSURLRequest *)webView:(WebView *)webView resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource { 161 | if (webView != _webView) { return request; } 162 | 163 | if (_webViewDelegate && [_webViewDelegate respondsToSelector:@selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:)]) { 164 | return [_webViewDelegate webView:webView resource:identifier willSendRequest:request redirectResponse:redirectResponse fromDataSource:dataSource]; 165 | } 166 | 167 | return request; 168 | } 169 | 170 | 171 | 172 | /* Platform specific internals: iOS 173 | **********************************/ 174 | #elif defined WVJB_PLATFORM_IOS 175 | 176 | - (void) _platformSpecificSetup:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(id)webViewDelegate handler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle{ 177 | _webView = webView; 178 | _webView.delegate = self; 179 | _webViewDelegate = webViewDelegate; 180 | _base = [[WebViewJavascriptBridgeBase alloc] initWithHandler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle]; 181 | _base.delegate = self; 182 | } 183 | 184 | - (void) _platformSpecificDealloc { 185 | _webView.delegate = nil; 186 | } 187 | 188 | - (void)webViewDidFinishLoad:(UIWebView *)webView { 189 | if (webView != _webView) { return; } 190 | 191 | _numRequestsLoading--; 192 | 193 | if (_numRequestsLoading == 0 && ![[webView stringByEvaluatingJavaScriptFromString:[_base webViewJavascriptCheckCommand]] isEqualToString:@"true"]) { 194 | [_base injectJavascriptFile:YES]; 195 | } 196 | [_base dispatchStartUpMessageQueue]; 197 | 198 | 199 | __strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate; 200 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webViewDidFinishLoad:)]) { 201 | [strongDelegate webViewDidFinishLoad:webView]; 202 | } 203 | } 204 | 205 | - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { 206 | if (webView != _webView) { return; } 207 | 208 | _numRequestsLoading--; 209 | 210 | __strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate; 211 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) { 212 | [strongDelegate webView:webView didFailLoadWithError:error]; 213 | } 214 | } 215 | 216 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { 217 | if (webView != _webView) { return YES; } 218 | NSURL *url = [request URL]; 219 | __strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate; 220 | if ([_base isCorrectProcotocolScheme:url]) { 221 | if ([_base isCorrectHost:url]) { 222 | NSString *messageQueueString = [self _evaluateJavascript:[_base webViewJavascriptFetchQueyCommand]]; 223 | [_base flushMessageQueue:messageQueueString]; 224 | } else { 225 | [_base logUnkownMessage:url]; 226 | } 227 | return NO; 228 | } else if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]) { 229 | return [strongDelegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType]; 230 | } else { 231 | return YES; 232 | } 233 | } 234 | 235 | - (void)webViewDidStartLoad:(UIWebView *)webView { 236 | if (webView != _webView) { return; } 237 | 238 | _numRequestsLoading++; 239 | 240 | __strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate; 241 | if (strongDelegate && [strongDelegate respondsToSelector:@selector(webViewDidStartLoad:)]) { 242 | [strongDelegate webViewDidStartLoad:webView]; 243 | } 244 | } 245 | 246 | #endif 247 | 248 | @end 249 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+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 | #import "SDWebImageManager.h" 11 | 12 | /** 13 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView. 14 | * 15 | * Usage with a UITableViewCell sub-class: 16 | * 17 | * @code 18 | 19 | #import 20 | 21 | ... 22 | 23 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 24 | { 25 | static NSString *MyIdentifier = @"MyIdentifier"; 26 | 27 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 28 | 29 | if (cell == nil) { 30 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] 31 | autorelease]; 32 | } 33 | 34 | // Here we use the provided sd_setImageWithURL: method to load the web image 35 | // Ensure you use a placeholder image otherwise cells will be initialized with no image 36 | [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"] 37 | placeholderImage:[UIImage imageNamed:@"placeholder"]]; 38 | 39 | cell.textLabel.text = @"My Text"; 40 | return cell; 41 | } 42 | 43 | * @endcode 44 | */ 45 | @interface UIImageView (WebCache) 46 | 47 | /** 48 | * Get the current image URL. 49 | * 50 | * Note that because of the limitations of categories this property can get out of sync 51 | * if you use sd_setImage: directly. 52 | */ 53 | - (NSURL *)sd_imageURL; 54 | 55 | /** 56 | * Set the imageView `image` with an `url`. 57 | * 58 | * The download is asynchronous and cached. 59 | * 60 | * @param url The url for the image. 61 | */ 62 | - (void)sd_setImageWithURL:(NSURL *)url; 63 | 64 | /** 65 | * Set the imageView `image` with an `url` and a placeholder. 66 | * 67 | * The download is asynchronous and cached. 68 | * 69 | * @param url The url for the image. 70 | * @param placeholder The image to be set initially, until the image request finishes. 71 | * @see sd_setImageWithURL:placeholderImage:options: 72 | */ 73 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder; 74 | 75 | /** 76 | * Set the imageView `image` with an `url`, placeholder and custom options. 77 | * 78 | * The download is asynchronous and cached. 79 | * 80 | * @param url The url for the image. 81 | * @param placeholder The image to be set initially, until the image request finishes. 82 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 83 | */ 84 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options; 85 | 86 | /** 87 | * Set the imageView `image` with an `url`. 88 | * 89 | * The download is asynchronous and cached. 90 | * 91 | * @param url The url for the image. 92 | * @param completedBlock A block called when operation has been completed. This block has no return value 93 | * and takes the requested UIImage as first parameter. In case of error the image parameter 94 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 95 | * indicating if the image was retrived from the local cache or from the network. 96 | * The fourth parameter is the original image url. 97 | */ 98 | - (void)sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock; 99 | 100 | /** 101 | * Set the imageView `image` with an `url`, placeholder. 102 | * 103 | * The download is asynchronous and cached. 104 | * 105 | * @param url The url for the image. 106 | * @param placeholder The image to be set initially, until the image request finishes. 107 | * @param completedBlock A block called when operation has been completed. This block has no return value 108 | * and takes the requested UIImage as first parameter. In case of error the image parameter 109 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 110 | * indicating if the image was retrived from the local cache or from the network. 111 | * The fourth parameter is the original image url. 112 | */ 113 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock; 114 | 115 | /** 116 | * Set the imageView `image` with an `url`, placeholder and custom options. 117 | * 118 | * The download is asynchronous and cached. 119 | * 120 | * @param url The url for the image. 121 | * @param placeholder The image to be set initially, until the image request finishes. 122 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 123 | * @param completedBlock A block called when operation has been completed. This block has no return value 124 | * and takes the requested UIImage as first parameter. In case of error the image parameter 125 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 126 | * indicating if the image was retrived from the local cache or from the network. 127 | * The fourth parameter is the original image url. 128 | */ 129 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock; 130 | 131 | /** 132 | * Set the imageView `image` with an `url`, placeholder and custom options. 133 | * 134 | * The download is asynchronous and cached. 135 | * 136 | * @param url The url for the image. 137 | * @param placeholder The image to be set initially, until the image request finishes. 138 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 139 | * @param progressBlock A block called while image is downloading 140 | * @param completedBlock A block called when operation has been completed. This block has no return value 141 | * and takes the requested UIImage as first parameter. In case of error the image parameter 142 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 143 | * indicating if the image was retrived from the local cache or from the network. 144 | * The fourth parameter is the original image url. 145 | */ 146 | - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock; 147 | 148 | /** 149 | * Set the imageView `image` with an `url` and a optionaly placeholder image. 150 | * 151 | * The download is asynchronous and cached. 152 | * 153 | * @param url The url for the image. 154 | * @param placeholder The image to be set initially, until the image request finishes. 155 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 156 | * @param progressBlock A block called while image is downloading 157 | * @param completedBlock A block called when operation has been completed. This block has no return value 158 | * and takes the requested UIImage as first parameter. In case of error the image parameter 159 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 160 | * indicating if the image was retrived from the local cache or from the network. 161 | * The fourth parameter is the original image url. 162 | */ 163 | - (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock; 164 | 165 | /** 166 | * Download an array of images and starts them in an animation loop 167 | * 168 | * @param arrayOfURLs An array of NSURL 169 | */ 170 | - (void)sd_setAnimationImagesWithURLs:(NSArray *)arrayOfURLs; 171 | 172 | /** 173 | * Cancel the current download 174 | */ 175 | - (void)sd_cancelCurrentImageLoad; 176 | 177 | - (void)sd_cancelCurrentAnimationImagesLoad; 178 | 179 | @end 180 | 181 | 182 | @interface UIImageView (WebCacheDeprecated) 183 | 184 | - (NSURL *)imageURL __deprecated_msg("Use `sd_imageURL`"); 185 | 186 | - (void)setImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:`"); 187 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:`"); 188 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options`"); 189 | 190 | - (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:completed:`"); 191 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:completed:`"); 192 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:completed:`"); 193 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:progress:completed:`"); 194 | 195 | - (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs __deprecated_msg("Use `sd_setAnimationImagesWithURLs:`"); 196 | 197 | - (void)cancelCurrentArrayLoad __deprecated_msg("Use `sd_cancelCurrentAnimationImagesLoad`"); 198 | 199 | - (void)cancelCurrentImageLoad __deprecated_msg("Use `sd_cancelCurrentImageLoad`"); 200 | 201 | @end 202 | -------------------------------------------------------------------------------- /news.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 药智新闻 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |
22 |
23 |
24 | 25 |

1521123 来自:药智新闻 作者:静

26 | 27 |

实时查询 药智网实时查询 药智网实时查询 药智网实时查询 药智网实时查询 药智网

28 | 29 |
30 |
31 | 32 |
33 |
34 |


医药界出大事儿了!


长生不老药终于研发出来啦?



……


周杰伦的《本草纲目》其实是李时珍唱的?



不懂流行文化真可怕。


我说的大事儿,是当高等医学院毕业生四处碰壁找不到工作。



当我们这群医药界老油条加班熬夜,却被老板骂效率低。



……


的时候。


有一个人,却同时被数家大型医药公司哄抢!



是因为他的高学历?



那一定是上面有人儿!



虽是一个制药企业小职员,新药研发时,他却总能第一时间找出公司研发新药的原料药供应商,把握最佳合作机会;他也能在药品销售时迅速准确的找出下游用户,发现更多更大范围的有效用户,实现公司效益的最大化……


能一次性掌握那么多准确有效的信息,他是怎么做到的呀?


听说他是用了“药智网美国DMF注册数据库”!


官方来源 权威保障


DMF注册是美国FDA在非专利药上市审批程序中的一个不可缺少的重要环节。对于医药企业来说,数据信息的准确性决定了公司生产方向以及营销手段的有效性。“药智网美国DMF注册数据库”经由药智网专业的医药信息专家团队从FDA官方网站收集整理而成。权威的数据来源,缜密的逻辑分类,是你了解行业DMF注册信息的最佳使用工具。


数据详尽 定期更新


“药智网美国DMF注册数据库”背后的医药专家团队每一个季度定期对数据进行更新,到目前为止共计注册信息28345条,并逐时增加。我们都知道,FDA网站上没有可供检索使用的数据库,而药智网美国DMF注册数据库的出现则有效的弥补了这一不足。同时,药智网美国DMF注册信息数据库提供.txt和.xls两种格式文件,方便用户对信息数据的查询与分析。


查询便捷 应有尽有


以“阿立哌唑”为例,在药智网美国DMF注册数据库“项目主题”框中输入药品学名,点击“查询”按钮(图一)。关于“阿立哌唑”的DMF注册信息便详尽的呈现在查询者眼前(图二)。同时,药智网美国DMF数据库带有的多功能检索,如“项目编号”、“注册时间”等,增加了药品的检索方向,为查询者提供了多角度的便捷查询方式。


(图一)


(图2)


工作中,我们时常抱怨信息资源的繁杂无序以及查询过程的费时费力。如果拥有“药智网美国DMF注册数据库”这样一款数据信息归纳整合工具,应时需要,实时查询,在第一时间掌握第一手信息,就能为公司带来最大化的效益。还在犹豫什么呢?快来下载吧。


链接地址:http://db.yaozh.com/dmf


35 |
36 | 37 |
38 | 39 |
40 | 41 | 42 | 43 | 44 | 51 | 154 | 155 | 156 | --------------------------------------------------------------------------------