├── ADViewDemo ├── ADViewDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── DesktopADView.xcscheme │ └── xcuserdata │ │ └── tim.xcuserdatad │ │ └── xcschemes │ │ ├── ADViewDemo.xcscheme │ │ └── xcschememanagement.plist ├── ADViewDemo.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── tim.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist ├── ADViewDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── adImage.imageset │ │ │ ├── 3.pdf │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── ADViewDemoTests │ ├── ADViewDemoTests.m │ └── Info.plist ├── DesktopADView │ ├── DesktopADViewFramework.h │ └── Info.plist ├── Podfile ├── Podfile.lock └── Pods │ ├── Headers │ ├── Private │ │ ├── SDCycleScrollView │ │ │ ├── SDCollectionViewCell.h │ │ │ ├── SDCycleScrollView.h │ │ │ ├── TAAbstractDotView.h │ │ │ ├── TAAnimatedDotView.h │ │ │ ├── TADotView.h │ │ │ ├── TAPageControl.h │ │ │ └── UIView+SDExtension.h │ │ └── SDWebImage │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── SDImageCache.h │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImageManager.h │ │ │ ├── SDWebImageOperation.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── UIButton+WebCache.h │ │ │ ├── UIImage+GIF.h │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── UIImageView+HighlightedWebCache.h │ │ │ ├── UIImageView+WebCache.h │ │ │ └── UIView+WebCacheOperation.h │ └── Public │ │ ├── SDCycleScrollView │ │ ├── SDCollectionViewCell.h │ │ ├── SDCycleScrollView.h │ │ ├── TAAbstractDotView.h │ │ ├── TAAnimatedDotView.h │ │ ├── TADotView.h │ │ ├── TAPageControl.h │ │ └── UIView+SDExtension.h │ │ └── SDWebImage │ │ ├── NSData+ImageContentType.h │ │ ├── SDImageCache.h │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── UIButton+WebCache.h │ │ ├── UIImage+GIF.h │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+WebCache.h │ │ └── UIView+WebCacheOperation.h │ ├── Manifest.lock │ ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── tim.xcuserdatad │ │ └── xcschemes │ │ ├── Pods-ADViewDemo.xcscheme │ │ ├── SDCycleScrollView.xcscheme │ │ ├── SDWebImage.xcscheme │ │ └── xcschememanagement.plist │ ├── SDCycleScrollView │ ├── LICENSE │ ├── README.md │ └── SDCycleScrollView │ │ └── Lib │ │ └── SDCycleScrollView │ │ ├── PageControl │ │ ├── TAAbstractDotView.h │ │ ├── TAAbstractDotView.m │ │ ├── TAAnimatedDotView.h │ │ ├── TAAnimatedDotView.m │ │ ├── TADotView.h │ │ ├── TADotView.m │ │ ├── TAPageControl.h │ │ └── TAPageControl.m │ │ ├── SDCollectionViewCell.h │ │ ├── SDCollectionViewCell.m │ │ ├── SDCycleScrollView.h │ │ ├── SDCycleScrollView.m │ │ ├── UIView+SDExtension.h │ │ └── UIView+SDExtension.m │ ├── SDWebImage │ ├── LICENSE │ ├── README.md │ └── SDWebImage │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── SDImageCache.h │ │ ├── SDImageCache.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageDecoder.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloader.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageDownloaderOperation.m │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageManager.m │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── SDWebImagePrefetcher.m │ │ ├── UIButton+WebCache.h │ │ ├── UIButton+WebCache.m │ │ ├── UIImage+GIF.h │ │ ├── UIImage+GIF.m │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── UIImageView+WebCache.m │ │ ├── UIView+WebCacheOperation.h │ │ └── UIView+WebCacheOperation.m │ └── Target Support Files │ ├── Pods-ADViewDemo │ ├── Pods-ADViewDemo-acknowledgements.markdown │ ├── Pods-ADViewDemo-acknowledgements.plist │ ├── Pods-ADViewDemo-dummy.m │ ├── Pods-ADViewDemo-frameworks.sh │ ├── Pods-ADViewDemo-resources.sh │ ├── Pods-ADViewDemo.debug.xcconfig │ └── Pods-ADViewDemo.release.xcconfig │ ├── SDCycleScrollView │ ├── SDCycleScrollView-dummy.m │ ├── SDCycleScrollView-prefix.pch │ └── SDCycleScrollView.xcconfig │ └── SDWebImage │ ├── SDWebImage-dummy.m │ ├── SDWebImage-prefix.pch │ └── SDWebImage.xcconfig ├── DesktopADView.podspec ├── DesktopADView ├── DesktopADView.h └── DesktopADView.m ├── LICENSE ├── README.md └── img ├── AD_Img.png └── AD_Img2.png /ADViewDemo/ADViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcodeproj/xcshareddata/xcschemes/DesktopADView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcodeproj/xcuserdata/tim.xcuserdatad/xcschemes/ADViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcodeproj/xcuserdata/tim.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ADViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | DesktopADView.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 4 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 03A1DE5B1B561137002A0993 21 | 22 | primary 23 | 24 | 25 | 03A1DE741B561137002A0993 26 | 27 | primary 28 | 29 | 30 | 222A6FBF1EEFC9270082A05B 31 | 32 | primary 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcworkspace/xcuserdata/tim.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpctt/DesktopADView/396947f20e0fcb4b79b9e2b466d96e12d6e7fdf6/ADViewDemo/ADViewDemo.xcworkspace/xcuserdata/tim.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo.xcworkspace/xcuserdata/tim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ADViewDemo 4 | // 5 | // Created by XU JUNJIE on 15/7/15. 6 | // Copyright (c) 2015 ISNC. 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 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ADViewDemo 4 | // 5 | // Created by XU JUNJIE on 15/7/15. 6 | // Copyright (c) 2015 ISNC. 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 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/Images.xcassets/adImage.imageset/3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpctt/DesktopADView/396947f20e0fcb4b79b9e2b466d96e12d6e7fdf6/ADViewDemo/ADViewDemo/Images.xcassets/adImage.imageset/3.pdf -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/Images.xcassets/adImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | 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 | 40 | 41 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ADViewDemo 4 | // 5 | // Created by XU JUNJIE on 15/7/15. 6 | // Copyright (c) 2015 ISNC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ADViewDemo 4 | // 5 | // Created by XU JUNJIE on 15/7/15. 6 | // Copyright (c) 2015 ISNC. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DesktopADView.h" 11 | 12 | #import 13 | 14 | @interface ViewController () 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.view .backgroundColor = [UIColor lightGrayColor]; 24 | 25 | DesktopADView *adView = [[DesktopADView alloc]init]; 26 | adView.closeBtnColor = [UIColor whiteColor]; 27 | adView.adRatio = 5/3.0; 28 | adView.widthToSuperView = 3/5.0; 29 | adView.anchorPointOffset = CGPointMake(20, 30); 30 | adView.delIconWidth = 50 ; 31 | adView.delIconDelt = 50 ; 32 | 33 | adView.showDelBtn = YES; 34 | adView.showDelLocType = DesktopADViewDelLocType_TopRight; 35 | 36 | ///删除按钮的大小.位置 37 | // adView.delIconWidth = 50; 38 | // adView.delIconDelt = 30; 39 | 40 | 41 | ///自定义的 adview, 我拓展为 SDCycleScrollView 42 | // adView.adView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageNamesGroup:@[@"adImage" , @"adImage" ]]; 43 | 44 | 45 | [adView showInView:self.view image:[UIImage imageNamed:@"adImage"]]; 46 | 47 | 48 | adView.tapAdviewBlock = ^BOOL(bool tapAdview ,NSInteger index){ 49 | 50 | NSLog(@"tap at :%ld",index); 51 | 52 | return NO; 53 | 54 | }; 55 | 56 | adView.tapCloseBlock = ^BOOL(bool tapAdview ,NSInteger index){ 57 | 58 | NSLog(@"tap close"); 59 | 60 | return NO; 61 | 62 | }; 63 | 64 | 65 | 66 | 67 | } 68 | 69 | - (void)didReceiveMemoryWarning { 70 | [super didReceiveMemoryWarning]; 71 | // Dispose of any resources that can be recreated. 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ADViewDemo 4 | // 5 | // Created by XU JUNJIE on 15/7/15. 6 | // Copyright (c) 2015 ISNC. 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 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemoTests/ADViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ADViewDemoTests.m 3 | // ADViewDemoTests 4 | // 5 | // Created by XU JUNJIE on 15/7/15. 6 | // Copyright (c) 2015 ISNC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ADViewDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ADViewDemoTests 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 | -------------------------------------------------------------------------------- /ADViewDemo/ADViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ADViewDemo/DesktopADView/DesktopADViewFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // DesktopADView.h 3 | // DesktopADView 4 | // 5 | // Created by tim on 2017/6/13. 6 | // Copyright © 2017年 ISNC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for DesktopADView. 12 | FOUNDATION_EXPORT double DesktopADViewVersionNumber; 13 | 14 | //! Project version string for DesktopADView. 15 | FOUNDATION_EXPORT const unsigned char DesktopADViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /ADViewDemo/DesktopADView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.3.1 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ADViewDemo/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | platform :ios, "8.0" 4 | 5 | target:ADViewDemo do 6 | 7 | pod 'SDCycleScrollView','~>1.65' 8 | 9 | 10 | 11 | 12 | end 13 | 14 | -------------------------------------------------------------------------------- /ADViewDemo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SDCycleScrollView (1.65): 3 | - SDWebImage (~> 3.7) 4 | - SDWebImage (3.8.2): 5 | - SDWebImage/Core (= 3.8.2) 6 | - SDWebImage/Core (3.8.2) 7 | 8 | DEPENDENCIES: 9 | - SDCycleScrollView (~> 1.65) 10 | 11 | SPEC CHECKSUMS: 12 | SDCycleScrollView: f72904c77698a7f93a41bcbbc2d78b073bf7326c 13 | SDWebImage: '098e97e6176540799c27e804c96653ee0833d13c' 14 | 15 | PODFILE CHECKSUM: 60057a555ae1b1028e6ce73ad429bb9c978bc7ec 16 | 17 | COCOAPODS: 1.0.1 18 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/SDCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/SDCycleScrollView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCycleScrollView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/TAAbstractDotView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAbstractDotView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/TAAnimatedDotView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/TADotView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TADotView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/TAPageControl.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAPageControl.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDCycleScrollView/UIView+SDExtension.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/UIView+SDExtension.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/SDCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/SDCycleScrollView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCycleScrollView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/TAAbstractDotView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAbstractDotView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/TAAnimatedDotView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/TADotView.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TADotView.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/TAPageControl.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAPageControl.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDCycleScrollView/UIView+SDExtension.h: -------------------------------------------------------------------------------- 1 | ../../../SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/UIView+SDExtension.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /ADViewDemo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SDCycleScrollView (1.65): 3 | - SDWebImage (~> 3.7) 4 | - SDWebImage (3.8.2): 5 | - SDWebImage/Core (= 3.8.2) 6 | - SDWebImage/Core (3.8.2) 7 | 8 | DEPENDENCIES: 9 | - SDCycleScrollView (~> 1.65) 10 | 11 | SPEC CHECKSUMS: 12 | SDCycleScrollView: f72904c77698a7f93a41bcbbc2d78b073bf7326c 13 | SDWebImage: '098e97e6176540799c27e804c96653ee0833d13c' 14 | 15 | PODFILE CHECKSUM: 60057a555ae1b1028e6ce73ad429bb9c978bc7ec 16 | 17 | COCOAPODS: 1.0.1 18 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Pods.xcodeproj/xcuserdata/tim.xcuserdatad/xcschemes/Pods-ADViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Pods.xcodeproj/xcuserdata/tim.xcuserdatad/xcschemes/SDCycleScrollView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Pods.xcodeproj/xcuserdata/tim.xcuserdatad/xcschemes/SDWebImage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Pods.xcodeproj/xcuserdata/tim.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-ADViewDemo.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | SDCycleScrollView.xcscheme 13 | 14 | orderHint 15 | 2 16 | 17 | SDWebImage.xcscheme 18 | 19 | orderHint 20 | 3 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | 2580A41BE479C3BA9DDD6844DC75EFDA 26 | 27 | primary 28 | 29 | 30 | 718360B2CB7F4FB6442E4BFC0275E2C7 31 | 32 | primary 33 | 34 | 35 | BDB059996C365612EF083EFA161CCCBF 36 | 37 | primary 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 GSD_iOS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/README.md: -------------------------------------------------------------------------------- 1 | # SDCycleScrollView(新建QQ交流群:185534916) 2 | ## ☆☆☆ “iOS图片、文字轮播器” ☆☆☆ 3 | 4 | ### 支持pod导入 5 | pod 'SDCycleScrollView','~> 1.64' 6 | 7 | 如果发现pod search SDCycleScrollView 搜索出来的不是最新版本,需要在终端执行cd转换文件路径命令退回到desktop,然后执行pod setup命令更新本地spec缓存(可能需要几分钟),然后再搜索就可以了 8 | 9 | ### 更改记录: 10 | 11 | 2016.05.27 -- 新增纯文字轮播、增加viewController在来回push时候出现的图片卡在中间的解决方案“解决viewWillAppear时出现时轮播图卡在一半的问题,在控制器viewWillAppear时调用 adjustWhenControllerViewWillAppera” 12 | 13 | 2016.04.21 -- 修复自定义图片的pagecontrol刷新图片数据时崩溃bug;设置单张图片时停止轮播 14 | 15 | 2016.03.31 -- 增加垂直方向滚动功能 16 | 17 | 2016.01.21 -- 修复加载时出现item size zero提示问题 18 | 19 | 2016.01.15 -- 兼容assets存放的本地图片 20 | 21 | 2016.01.06 -- 0.图片管理使用SDWebImage;1.优化内存,提升性能;2.添加图片contentmode接口;3.block监听点击接口;4.滚动到某张图片监听;5.增加自定义图片pageControl接口;6.其他等等。其中有一处接口改动:pagecontrol的小圆点自定义接口改为:currentPageDotColor、pageDotColor、currentPageDotImage、pageDotImage。 22 | 23 | 24 | ### 无限循环自动图片轮播器(一步设置即可使用) 25 | 26 | // 网络加载图片的轮播器 27 | SDCycleScrollView *cycleScrollView = [cycleScrollViewWithFrame:frame delegate:delegate placeholderImage:placeholderImage]; 28 | cycleScrollView.imageURLStringsGroup = imagesURLStrings; 29 | 30 | // 本地加载图片的轮播器 31 | SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame: imagesGroup:图片数组]; 32 | 33 | 34 | --------------------------------------------------------------------------------------------------------------- 35 | 36 | ## ??? 为什么我用这个轮播期会在顶部出现一块空白区域 37 | 以下是本库的使用者给出的一些解决方法放在这里供大家参考: 38 | 在iOS 7以后,controller 会对其中唯一的scrollView或其子类调整内边距,从而导致位置不准确。设置self.automaticallyAdjustsScrollViewInsets = NO;或者controller中放置不止一个scrollView或其子类时,就不会出现这种问题。以上原因是我的猜测,只要我设置了 self.automaticallyAdjustsScrollViewInsets = NO就没有那个问题了。 39 | 40 | #PS: 41 | 42 | 如需更详细的设置,参考如下: 43 | 44 | 1. cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentRight; // 设置pageControl居右,默认居中 45 | 46 | 2. cycleScrollView.titlesGroup = 标题数组(数组元素个数必须和图片数组元素个数保持一致); // 如果设置title数组,则会在图片下面添加标题 47 | 48 | 3. cycleScrollView.delegate = ; // 如需监听图片点击,请设置代理,实现代理方法 49 | 50 | 4. cycleScrollView.autoScrollTimeInterval = ;// 自定义轮播时间间隔 51 | 52 | ![](http://ww4.sinaimg.cn/bmiddle/9b8146edjw1esvytq7lwrg208p0fce82.gif) 53 | 54 | ![](http://cdn.cocimg.com/bbs/attachment/Fid_19/19_441660_d01407e9c4b63d1.gif) 55 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAbstractDotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAAbstractDotView.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface TAAbstractDotView : UIView 13 | 14 | 15 | /** 16 | * A method call let view know which state appearance it should take. Active meaning it's current page. Inactive not the current page. 17 | * 18 | * @param active BOOL to tell if view is active or not 19 | */ 20 | - (void)changeActivityState:(BOOL)active; 21 | 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAbstractDotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TAAbstractDotView.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAbstractDotView.h" 10 | 11 | 12 | @implementation TAAbstractDotView 13 | 14 | 15 | - (id)init 16 | { 17 | @throw [NSException exceptionWithName:NSInternalInconsistencyException 18 | reason:[NSString stringWithFormat:@"You must override %@ in %@", NSStringFromSelector(_cmd), self.class] 19 | userInfo:nil]; 20 | } 21 | 22 | 23 | - (void)changeActivityState:(BOOL)active 24 | { 25 | @throw [NSException exceptionWithName:NSInternalInconsistencyException 26 | reason:[NSString stringWithFormat:@"You must override %@ in %@", NSStringFromSelector(_cmd), self.class] 27 | userInfo:nil]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAAnimatedDotView.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAbstractDotView.h" 10 | 11 | @interface TAAnimatedDotView : TAAbstractDotView 12 | 13 | @property (nonatomic, strong) UIColor *dotColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TAAnimatedDotView.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAnimatedDotView.h" 10 | 11 | static CGFloat const kAnimateDuration = 1; 12 | 13 | @implementation TAAnimatedDotView 14 | 15 | - (instancetype)init 16 | { 17 | self = [super init]; 18 | if (self) { 19 | [self initialization]; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | 26 | - (id)initWithFrame:(CGRect)frame 27 | { 28 | self = [super initWithFrame:frame]; 29 | if (self) { 30 | [self initialization]; 31 | } 32 | return self; 33 | } 34 | 35 | 36 | - (id)initWithCoder:(NSCoder *)aDecoder 37 | { 38 | self = [super initWithCoder:aDecoder]; 39 | if (self) { 40 | [self initialization]; 41 | } 42 | 43 | return self; 44 | } 45 | 46 | - (void)setDotColor:(UIColor *)dotColor 47 | { 48 | _dotColor = dotColor; 49 | self.layer.borderColor = dotColor.CGColor; 50 | } 51 | 52 | - (void)initialization 53 | { 54 | _dotColor = [UIColor whiteColor]; 55 | self.backgroundColor = [UIColor clearColor]; 56 | self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2; 57 | self.layer.borderColor = [UIColor whiteColor].CGColor; 58 | self.layer.borderWidth = 2; 59 | } 60 | 61 | 62 | - (void)changeActivityState:(BOOL)active 63 | { 64 | if (active) { 65 | [self animateToActiveState]; 66 | } else { 67 | [self animateToDeactiveState]; 68 | } 69 | } 70 | 71 | 72 | - (void)animateToActiveState 73 | { 74 | [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:-20 options:UIViewAnimationOptionCurveLinear animations:^{ 75 | self.backgroundColor = _dotColor; 76 | self.transform = CGAffineTransformMakeScale(1.4, 1.4); 77 | } completion:nil]; 78 | } 79 | 80 | - (void)animateToDeactiveState 81 | { 82 | [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:0 options:UIViewAnimationOptionCurveLinear animations:^{ 83 | self.backgroundColor = [UIColor clearColor]; 84 | self.transform = CGAffineTransformIdentity; 85 | } completion:nil]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TADotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TADotView.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAbstractDotView.h" 10 | 11 | @interface TADotView : TAAbstractDotView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TADotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TADotView.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TADotView.h" 10 | 11 | @implementation TADotView 12 | 13 | 14 | - (instancetype)init 15 | { 16 | self = [super init]; 17 | if (self) { 18 | [self initialization]; 19 | } 20 | 21 | return self; 22 | } 23 | 24 | 25 | - (id)initWithFrame:(CGRect)frame 26 | { 27 | self = [super initWithFrame:frame]; 28 | if (self) { 29 | [self initialization]; 30 | } 31 | return self; 32 | } 33 | 34 | 35 | - (id)initWithCoder:(NSCoder *)aDecoder 36 | { 37 | self = [super initWithCoder:aDecoder]; 38 | if (self) { 39 | [self initialization]; 40 | } 41 | 42 | return self; 43 | } 44 | 45 | - (void)initialization 46 | { 47 | self.backgroundColor = [UIColor clearColor]; 48 | self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2; 49 | self.layer.borderColor = [UIColor whiteColor].CGColor; 50 | self.layer.borderWidth = 2; 51 | } 52 | 53 | 54 | - (void)changeActivityState:(BOOL)active 55 | { 56 | if (active) { 57 | self.backgroundColor = [UIColor whiteColor]; 58 | } else { 59 | self.backgroundColor = [UIColor clearColor]; 60 | } 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAPageControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAPageControl.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-21. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol TAPageControlDelegate; 12 | 13 | 14 | @interface TAPageControl : UIControl 15 | 16 | 17 | /** 18 | * Dot view customization properties 19 | */ 20 | 21 | /** 22 | * The Class of your custom UIView, make sure to respect the TAAbstractDotView class. 23 | */ 24 | @property (nonatomic) Class dotViewClass; 25 | 26 | 27 | /** 28 | * UIImage to represent a dot. 29 | */ 30 | @property (nonatomic) UIImage *dotImage; 31 | 32 | 33 | /** 34 | * UIImage to represent current page dot. 35 | */ 36 | @property (nonatomic) UIImage *currentDotImage; 37 | 38 | 39 | /** 40 | * Dot size for dot views. Default is 8 by 8. 41 | */ 42 | @property (nonatomic) CGSize dotSize; 43 | 44 | 45 | @property (nonatomic, strong) UIColor *dotColor; 46 | 47 | /** 48 | * Spacing between two dot views. Default is 8. 49 | */ 50 | @property (nonatomic) NSInteger spacingBetweenDots; 51 | 52 | 53 | /** 54 | * Page control setup properties 55 | */ 56 | 57 | 58 | /** 59 | * Delegate for TAPageControl 60 | */ 61 | @property(nonatomic,assign) id delegate; 62 | 63 | 64 | /** 65 | * Number of pages for control. Default is 0. 66 | */ 67 | @property (nonatomic) NSInteger numberOfPages; 68 | 69 | 70 | /** 71 | * Current page on which control is active. Default is 0. 72 | */ 73 | @property (nonatomic) NSInteger currentPage; 74 | 75 | 76 | /** 77 | * Hide the control if there is only one page. Default is NO. 78 | */ 79 | @property (nonatomic) BOOL hidesForSinglePage; 80 | 81 | 82 | /** 83 | * Let the control know if should grow bigger by keeping center, or just get longer (right side expanding). By default YES. 84 | */ 85 | @property (nonatomic) BOOL shouldResizeFromCenter; 86 | 87 | 88 | /** 89 | * Return the minimum size required to display control properly for the given page count. 90 | * 91 | * @param pageCount Number of dots that will require display 92 | * 93 | * @return The CGSize being the minimum size required. 94 | */ 95 | - (CGSize)sizeForNumberOfPages:(NSInteger)pageCount; 96 | 97 | 98 | @end 99 | 100 | 101 | @protocol TAPageControlDelegate 102 | 103 | @optional 104 | - (void)TAPageControl:(TAPageControl *)pageControl didSelectPageAtIndex:(NSInteger)index; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAPageControl.m: -------------------------------------------------------------------------------- 1 | // 2 | // TAPageControl.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-21. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAPageControl.h" 10 | #import "TAAbstractDotView.h" 11 | #import "TAAnimatedDotView.h" 12 | #import "TADotView.h" 13 | 14 | /** 15 | * Default number of pages for initialization 16 | */ 17 | static NSInteger const kDefaultNumberOfPages = 0; 18 | 19 | /** 20 | * Default current page for initialization 21 | */ 22 | static NSInteger const kDefaultCurrentPage = 0; 23 | 24 | /** 25 | * Default setting for hide for single page feature. For initialization 26 | */ 27 | static BOOL const kDefaultHideForSinglePage = NO; 28 | 29 | /** 30 | * Default setting for shouldResizeFromCenter. For initialiation 31 | */ 32 | static BOOL const kDefaultShouldResizeFromCenter = YES; 33 | 34 | /** 35 | * Default spacing between dots 36 | */ 37 | static NSInteger const kDefaultSpacingBetweenDots = 8; 38 | 39 | /** 40 | * Default dot size 41 | */ 42 | static CGSize const kDefaultDotSize = {8, 8}; 43 | 44 | 45 | @interface TAPageControl() 46 | 47 | 48 | /** 49 | * Array of dot views for reusability and touch events. 50 | */ 51 | @property (strong, nonatomic) NSMutableArray *dots; 52 | 53 | 54 | @end 55 | 56 | @implementation TAPageControl 57 | 58 | 59 | #pragma mark - Lifecycle 60 | 61 | 62 | - (id)init 63 | { 64 | self = [super init]; 65 | if (self) { 66 | [self initialization]; 67 | } 68 | 69 | return self; 70 | } 71 | 72 | 73 | - (id)initWithFrame:(CGRect)frame 74 | { 75 | self = [super initWithFrame:frame]; 76 | if (self) { 77 | [self initialization]; 78 | } 79 | return self; 80 | } 81 | 82 | 83 | - (id)initWithCoder:(NSCoder *)aDecoder 84 | { 85 | self = [super initWithCoder:aDecoder]; 86 | if (self) { 87 | [self initialization]; 88 | } 89 | 90 | return self; 91 | } 92 | 93 | 94 | /** 95 | * Default setup when initiating control 96 | */ 97 | - (void)initialization 98 | { 99 | self.dotViewClass = [TAAnimatedDotView class]; 100 | self.spacingBetweenDots = kDefaultSpacingBetweenDots; 101 | self.numberOfPages = kDefaultNumberOfPages; 102 | self.currentPage = kDefaultCurrentPage; 103 | self.hidesForSinglePage = kDefaultHideForSinglePage; 104 | self.shouldResizeFromCenter = kDefaultShouldResizeFromCenter; 105 | } 106 | 107 | 108 | #pragma mark - Touch event 109 | 110 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 111 | { 112 | UITouch *touch = [touches anyObject]; 113 | if (touch.view != self) { 114 | NSInteger index = [self.dots indexOfObject:touch.view]; 115 | if ([self.delegate respondsToSelector:@selector(TAPageControl:didSelectPageAtIndex:)]) { 116 | [self.delegate TAPageControl:self didSelectPageAtIndex:index]; 117 | } 118 | } 119 | } 120 | 121 | #pragma mark - Layout 122 | 123 | 124 | /** 125 | * Resizes and moves the receiver view so it just encloses its subviews. 126 | */ 127 | - (void)sizeToFit 128 | { 129 | [self updateFrame:YES]; 130 | } 131 | 132 | 133 | - (CGSize)sizeForNumberOfPages:(NSInteger)pageCount 134 | { 135 | return CGSizeMake((self.dotSize.width + self.spacingBetweenDots) * pageCount - self.spacingBetweenDots , self.dotSize.height); 136 | } 137 | 138 | 139 | /** 140 | * Will update dots display and frame. Reuse existing views or instantiate one if required. Update their position in case frame changed. 141 | */ 142 | - (void)updateDots 143 | { 144 | if (self.numberOfPages == 0) { 145 | return; 146 | } 147 | 148 | for (NSInteger i = 0; i < self.numberOfPages; i++) { 149 | 150 | UIView *dot; 151 | if (i < self.dots.count) { 152 | dot = [self.dots objectAtIndex:i]; 153 | } else { 154 | dot = [self generateDotView]; 155 | } 156 | 157 | [self updateDotFrame:dot atIndex:i]; 158 | } 159 | 160 | [self changeActivity:YES atIndex:self.currentPage]; 161 | 162 | [self hideForSinglePage]; 163 | } 164 | 165 | 166 | /** 167 | * Update frame control to fit current number of pages. It will apply required size if authorize and required. 168 | * 169 | * @param overrideExistingFrame BOOL to allow frame to be overriden. Meaning the required size will be apply no mattter what. 170 | */ 171 | - (void)updateFrame:(BOOL)overrideExistingFrame 172 | { 173 | CGPoint center = self.center; 174 | CGSize requiredSize = [self sizeForNumberOfPages:self.numberOfPages]; 175 | 176 | // We apply requiredSize only if authorize to and necessary 177 | if (overrideExistingFrame || ((CGRectGetWidth(self.frame) < requiredSize.width || CGRectGetHeight(self.frame) < requiredSize.height) && !overrideExistingFrame)) { 178 | self.frame = CGRectMake(CGRectGetMinX(self.frame), CGRectGetMinY(self.frame), requiredSize.width, requiredSize.height); 179 | if (self.shouldResizeFromCenter) { 180 | self.center = center; 181 | } 182 | } 183 | 184 | [self resetDotViews]; 185 | } 186 | 187 | 188 | /** 189 | * Update the frame of a specific dot at a specific index 190 | * 191 | * @param dot Dot view 192 | * @param index Page index of dot 193 | */ 194 | - (void)updateDotFrame:(UIView *)dot atIndex:(NSInteger)index 195 | { 196 | // Dots are always centered within view 197 | CGFloat x = (self.dotSize.width + self.spacingBetweenDots) * index + ( (CGRectGetWidth(self.frame) - [self sizeForNumberOfPages:self.numberOfPages].width) / 2); 198 | CGFloat y = (CGRectGetHeight(self.frame) - self.dotSize.height) / 2; 199 | 200 | dot.frame = CGRectMake(x, y, self.dotSize.width, self.dotSize.height); 201 | } 202 | 203 | 204 | #pragma mark - Utils 205 | 206 | 207 | /** 208 | * Generate a dot view and add it to the collection 209 | * 210 | * @return The UIView object representing a dot 211 | */ 212 | - (UIView *)generateDotView 213 | { 214 | UIView *dotView; 215 | 216 | if (self.dotViewClass) { 217 | dotView = [[self.dotViewClass alloc] initWithFrame:CGRectMake(0, 0, self.dotSize.width, self.dotSize.height)]; 218 | if ([dotView isKindOfClass:[TAAnimatedDotView class]] && self.dotColor) { 219 | ((TAAnimatedDotView *)dotView).dotColor = self.dotColor; 220 | } 221 | } else { 222 | dotView = [[UIImageView alloc] initWithImage:self.dotImage]; 223 | dotView.frame = CGRectMake(0, 0, self.dotSize.width, self.dotSize.height); 224 | } 225 | 226 | if (dotView) { 227 | [self addSubview:dotView]; 228 | [self.dots addObject:dotView]; 229 | } 230 | 231 | dotView.userInteractionEnabled = YES; 232 | return dotView; 233 | } 234 | 235 | 236 | /** 237 | * Change activity state of a dot view. Current/not currrent. 238 | * 239 | * @param active Active state to apply 240 | * @param index Index of dot for state update 241 | */ 242 | - (void)changeActivity:(BOOL)active atIndex:(NSInteger)index 243 | { 244 | if (self.dotViewClass) { 245 | TAAbstractDotView *abstractDotView = (TAAbstractDotView *)[self.dots objectAtIndex:index]; 246 | if ([abstractDotView respondsToSelector:@selector(changeActivityState:)]) { 247 | [abstractDotView changeActivityState:active]; 248 | } else { 249 | NSLog(@"Custom view : %@ must implement an 'changeActivityState' method or you can subclass %@ to help you.", self.dotViewClass, [TAAbstractDotView class]); 250 | } 251 | } else if (self.dotImage && self.currentDotImage) { 252 | UIImageView *dotView = (UIImageView *)[self.dots objectAtIndex:index]; 253 | dotView.image = (active) ? self.currentDotImage : self.dotImage; 254 | } 255 | } 256 | 257 | 258 | - (void)resetDotViews 259 | { 260 | for (UIView *dotView in self.dots) { 261 | [dotView removeFromSuperview]; 262 | } 263 | 264 | [self.dots removeAllObjects]; 265 | [self updateDots]; 266 | } 267 | 268 | 269 | - (void)hideForSinglePage 270 | { 271 | if (self.dots.count == 1 && self.hidesForSinglePage) { 272 | self.hidden = YES; 273 | } else { 274 | self.hidden = NO; 275 | } 276 | } 277 | 278 | #pragma mark - Setters 279 | 280 | 281 | - (void)setNumberOfPages:(NSInteger)numberOfPages 282 | { 283 | _numberOfPages = numberOfPages; 284 | 285 | // Update dot position to fit new number of pages 286 | [self resetDotViews]; 287 | } 288 | 289 | 290 | - (void)setSpacingBetweenDots:(NSInteger)spacingBetweenDots 291 | { 292 | _spacingBetweenDots = spacingBetweenDots; 293 | 294 | [self resetDotViews]; 295 | } 296 | 297 | 298 | - (void)setCurrentPage:(NSInteger)currentPage 299 | { 300 | // If no pages, no current page to treat. 301 | if (self.numberOfPages == 0 || currentPage == _currentPage) { 302 | _currentPage = currentPage; 303 | return; 304 | } 305 | 306 | // Pre set 307 | [self changeActivity:NO atIndex:_currentPage]; 308 | _currentPage = currentPage; 309 | // Post set 310 | [self changeActivity:YES atIndex:_currentPage]; 311 | } 312 | 313 | 314 | - (void)setDotImage:(UIImage *)dotImage 315 | { 316 | _dotImage = dotImage; 317 | [self resetDotViews]; 318 | self.dotViewClass = nil; 319 | } 320 | 321 | 322 | - (void)setCurrentDotImage:(UIImage *)currentDotimage 323 | { 324 | _currentDotImage = currentDotimage; 325 | [self resetDotViews]; 326 | self.dotViewClass = nil; 327 | } 328 | 329 | 330 | - (void)setDotViewClass:(Class)dotViewClass 331 | { 332 | _dotViewClass = dotViewClass; 333 | self.dotSize = CGSizeZero; 334 | [self resetDotViews]; 335 | } 336 | 337 | 338 | #pragma mark - Getters 339 | 340 | 341 | - (NSMutableArray *)dots 342 | { 343 | if (!_dots) { 344 | _dots = [[NSMutableArray alloc] init]; 345 | } 346 | 347 | return _dots; 348 | } 349 | 350 | 351 | - (CGSize)dotSize 352 | { 353 | // Dot size logic depending on the source of the dot view 354 | if (self.dotImage && CGSizeEqualToSize(_dotSize, CGSizeZero)) { 355 | _dotSize = self.dotImage.size; 356 | } else if (self.dotViewClass && CGSizeEqualToSize(_dotSize, CGSizeZero)) { 357 | _dotSize = kDefaultDotSize; 358 | return _dotSize; 359 | } 360 | 361 | return _dotSize; 362 | } 363 | 364 | @end 365 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDCollectionViewCell.h 3 | // SDCycleScrollView 4 | // 5 | // Created by aier on 15-3-22. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | 32 | 33 | #import 34 | 35 | @interface SDCollectionViewCell : UICollectionViewCell 36 | 37 | @property (weak, nonatomic) UIImageView *imageView; 38 | @property (copy, nonatomic) NSString *title; 39 | 40 | @property (nonatomic, strong) UIColor *titleLabelTextColor; 41 | @property (nonatomic, strong) UIFont *titleLabelTextFont; 42 | @property (nonatomic, strong) UIColor *titleLabelBackgroundColor; 43 | @property (nonatomic, assign) CGFloat titleLabelHeight; 44 | 45 | @property (nonatomic, assign) BOOL hasConfigured; 46 | 47 | /** 只展示文字轮播 */ 48 | @property (nonatomic, assign) BOOL onlyDisplayText; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDCollectionViewCell.m 3 | // SDCycleScrollView 4 | // 5 | // Created by aier on 15-3-22. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | 10 | /* 11 | 12 | ********************************************************************************* 13 | * 14 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 15 | * 16 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 17 | * 帮您解决问题。 18 | * 新浪微博:GSD_iOS 19 | * Email : gsdios@126.com 20 | * GitHub: https://github.com/gsdios 21 | * 22 | * 另(我的自动布局库SDAutoLayout): 23 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 24 | * 做最简单易用的AutoLayout库。 25 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 26 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 27 | * GitHub:https://github.com/gsdios/SDAutoLayout 28 | ********************************************************************************* 29 | 30 | */ 31 | 32 | 33 | #import "SDCollectionViewCell.h" 34 | #import "UIView+SDExtension.h" 35 | 36 | @implementation SDCollectionViewCell 37 | { 38 | __weak UILabel *_titleLabel; 39 | } 40 | 41 | 42 | - (instancetype)initWithFrame:(CGRect)frame 43 | { 44 | if (self = [super initWithFrame:frame]) { 45 | [self setupImageView]; 46 | [self setupTitleLabel]; 47 | } 48 | 49 | return self; 50 | } 51 | 52 | - (void)setTitleLabelBackgroundColor:(UIColor *)titleLabelBackgroundColor 53 | { 54 | _titleLabelBackgroundColor = titleLabelBackgroundColor; 55 | _titleLabel.backgroundColor = titleLabelBackgroundColor; 56 | } 57 | 58 | - (void)setTitleLabelTextColor:(UIColor *)titleLabelTextColor 59 | { 60 | _titleLabelTextColor = titleLabelTextColor; 61 | _titleLabel.textColor = titleLabelTextColor; 62 | } 63 | 64 | - (void)setTitleLabelTextFont:(UIFont *)titleLabelTextFont 65 | { 66 | _titleLabelTextFont = titleLabelTextFont; 67 | _titleLabel.font = titleLabelTextFont; 68 | } 69 | 70 | - (void)setupImageView 71 | { 72 | UIImageView *imageView = [[UIImageView alloc] init]; 73 | _imageView = imageView; 74 | [self.contentView addSubview:imageView]; 75 | } 76 | 77 | - (void)setupTitleLabel 78 | { 79 | UILabel *titleLabel = [[UILabel alloc] init]; 80 | _titleLabel = titleLabel; 81 | _titleLabel.hidden = YES; 82 | [self.contentView addSubview:titleLabel]; 83 | } 84 | 85 | - (void)setTitle:(NSString *)title 86 | { 87 | _title = [title copy]; 88 | _titleLabel.text = [NSString stringWithFormat:@" %@", title]; 89 | if (_titleLabel.hidden) { 90 | _titleLabel.hidden = NO; 91 | } 92 | } 93 | 94 | 95 | - (void)layoutSubviews 96 | { 97 | [super layoutSubviews]; 98 | 99 | if (self.onlyDisplayText) { 100 | _titleLabel.frame = self.bounds; 101 | } else { 102 | _imageView.frame = self.bounds; 103 | CGFloat titleLabelW = self.sd_width; 104 | CGFloat titleLabelH = _titleLabelHeight; 105 | CGFloat titleLabelX = 0; 106 | CGFloat titleLabelY = self.sd_height - titleLabelH; 107 | _titleLabel.frame = CGRectMake(titleLabelX, titleLabelY, titleLabelW, titleLabelH); 108 | } 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCycleScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDCycleScrollView.h 3 | // SDCycleScrollView 4 | // 5 | // Created by aier on 15-3-22. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | /* 32 | * 当前版本为1.62 33 | * 更新日期:2016.04.21 34 | */ 35 | 36 | #import 37 | 38 | typedef enum { 39 | SDCycleScrollViewPageContolAlimentRight, 40 | SDCycleScrollViewPageContolAlimentCenter 41 | } SDCycleScrollViewPageContolAliment; 42 | 43 | typedef enum { 44 | SDCycleScrollViewPageContolStyleClassic, // 系统自带经典样式 45 | SDCycleScrollViewPageContolStyleAnimated, // 动画效果pagecontrol 46 | SDCycleScrollViewPageContolStyleNone // 不显示pagecontrol 47 | } SDCycleScrollViewPageContolStyle; 48 | 49 | @class SDCycleScrollView; 50 | 51 | @protocol SDCycleScrollViewDelegate 52 | 53 | @optional 54 | 55 | /** 点击图片回调 */ 56 | - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index; 57 | 58 | /** 图片滚动回调 */ 59 | - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index; 60 | 61 | @end 62 | 63 | @interface SDCycleScrollView : UIView 64 | 65 | 66 | /** 初始轮播图(推荐使用) */ 67 | + (instancetype)cycleScrollViewWithFrame:(CGRect)frame delegate:(id)delegate placeholderImage:(UIImage *)placeholderImage; 68 | 69 | + (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageURLStringsGroup:(NSArray *)imageURLStringsGroup; 70 | 71 | 72 | /** 本地图片轮播初始化方式 */ 73 | + (instancetype)cycleScrollViewWithFrame:(CGRect)frame imageNamesGroup:(NSArray *)imageNamesGroup; 74 | 75 | /** 本地图片轮播初始化方式2,infiniteLoop:是否无限循环 */ 76 | + (instancetype)cycleScrollViewWithFrame:(CGRect)frame shouldInfiniteLoop:(BOOL)infiniteLoop imageNamesGroup:(NSArray *)imageNamesGroup; 77 | 78 | 79 | ////////////////////// 数据源接口 ////////////////////// 80 | 81 | /** 网络图片 url string 数组 */ 82 | @property (nonatomic, strong) NSArray *imageURLStringsGroup; 83 | 84 | /** 每张图片对应要显示的文字数组 */ 85 | @property (nonatomic, strong) NSArray *titlesGroup; 86 | 87 | /** 本地图片数组 */ 88 | @property (nonatomic, strong) NSArray *localizationImageNamesGroup; 89 | 90 | 91 | 92 | 93 | 94 | ////////////////////// 滚动控制接口 ////////////////////// 95 | 96 | /** 自动滚动间隔时间,默认2s */ 97 | @property (nonatomic, assign) CGFloat autoScrollTimeInterval; 98 | 99 | /** 是否无限循环,默认Yes */ 100 | @property (nonatomic,assign) BOOL infiniteLoop; 101 | 102 | /** 是否自动滚动,默认Yes */ 103 | @property (nonatomic,assign) BOOL autoScroll; 104 | 105 | /** 图片滚动方向,默认为水平滚动 */ 106 | @property (nonatomic, assign) UICollectionViewScrollDirection scrollDirection; 107 | 108 | @property (nonatomic, weak) id delegate; 109 | 110 | /** block方式监听点击 */ 111 | @property (nonatomic, copy) void (^clickItemOperationBlock)(NSInteger currentIndex); 112 | 113 | /** block方式监听滚动 */ 114 | @property (nonatomic, copy) void (^itemDidScrollOperationBlock)(NSInteger currentIndex); 115 | 116 | /** 解决viewWillAppear时出现时轮播图卡在一半的问题,在控制器viewWillAppear时调用此方法 */ 117 | - (void)adjustWhenControllerViewWillAppera; 118 | 119 | ////////////////////// 自定义样式接口 ////////////////////// 120 | 121 | 122 | /** 轮播图片的ContentMode,默认为 UIViewContentModeScaleToFill */ 123 | @property (nonatomic, assign) UIViewContentMode bannerImageViewContentMode; 124 | 125 | /** 占位图,用于网络未加载到图片时 */ 126 | @property (nonatomic, strong) UIImage *placeholderImage; 127 | 128 | /** 是否显示分页控件 */ 129 | @property (nonatomic, assign) BOOL showPageControl; 130 | 131 | /** 是否在只有一张图时隐藏pagecontrol,默认为YES */ 132 | @property(nonatomic) BOOL hidesForSinglePage; 133 | 134 | /** 只展示文字轮播 */ 135 | @property (nonatomic, assign) BOOL onlyDisplayText; 136 | 137 | /** pagecontrol 样式,默认为动画样式 */ 138 | @property (nonatomic, assign) SDCycleScrollViewPageContolStyle pageControlStyle; 139 | 140 | /** 分页控件位置 */ 141 | @property (nonatomic, assign) SDCycleScrollViewPageContolAliment pageControlAliment; 142 | 143 | /** 分页控件小圆标大小 */ 144 | @property (nonatomic, assign) CGSize pageControlDotSize; 145 | 146 | /** 当前分页控件小圆标颜色 */ 147 | @property (nonatomic, strong) UIColor *currentPageDotColor; 148 | 149 | /** 其他分页控件小圆标颜色 */ 150 | @property (nonatomic, strong) UIColor *pageDotColor; 151 | 152 | /** 当前分页控件小圆标图片 */ 153 | @property (nonatomic, strong) UIImage *currentPageDotImage; 154 | 155 | /** 其他分页控件小圆标图片 */ 156 | @property (nonatomic, strong) UIImage *pageDotImage; 157 | 158 | /** 轮播文字label字体颜色 */ 159 | @property (nonatomic, strong) UIColor *titleLabelTextColor; 160 | 161 | /** 轮播文字label字体大小 */ 162 | @property (nonatomic, strong) UIFont *titleLabelTextFont; 163 | 164 | /** 轮播文字label背景颜色 */ 165 | @property (nonatomic, strong) UIColor *titleLabelBackgroundColor; 166 | 167 | /** 轮播文字label高度 */ 168 | @property (nonatomic, assign) CGFloat titleLabelHeight; 169 | 170 | 171 | 172 | ////////////////////// 清除缓存接口 ////////////////////// 173 | 174 | /** 清除图片缓存(此次升级后统一使用SDWebImage管理图片加载和缓存) */ 175 | + (void)clearImagesCache; 176 | 177 | /** 清除图片缓存(兼容旧版本方法) */ 178 | - (void)clearCache; 179 | 180 | @end 181 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/UIView+SDExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+SDExtension.h 3 | // SDRefreshView 4 | // 5 | // Created by aier on 15-2-23. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | #import 32 | 33 | #define SDColorCreater(r, g, b, a) [UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:a] 34 | 35 | 36 | @interface UIView (SDExtension) 37 | 38 | @property (nonatomic, assign) CGFloat sd_height; 39 | @property (nonatomic, assign) CGFloat sd_width; 40 | 41 | @property (nonatomic, assign) CGFloat sd_y; 42 | @property (nonatomic, assign) CGFloat sd_x; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/UIView+SDExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+SDExtension.m 3 | // SDRefreshView 4 | // 5 | // Created by aier on 15-2-23. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | /* 32 | 33 | ********************************************************************************* 34 | * 35 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 36 | * 帮您解决问题。 37 | * 新浪微博:GSD_iOS 38 | * Email : gsdios@126.com 39 | * GitHub: https://github.com/gsdios 40 | * 41 | * 另(我的自动布局库SDAutoLayout): 42 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 43 | * 做最简单易用的AutoLayout库。 44 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 45 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 46 | * GitHub:https://github.com/gsdios/SDAutoLayout 47 | ********************************************************************************* 48 | 49 | */ 50 | 51 | 52 | #import "UIView+SDExtension.h" 53 | 54 | @implementation UIView (SDExtension) 55 | 56 | - (CGFloat)sd_height 57 | { 58 | return self.frame.size.height; 59 | } 60 | 61 | - (void)setSd_height:(CGFloat)sd_height 62 | { 63 | CGRect temp = self.frame; 64 | temp.size.height = sd_height; 65 | self.frame = temp; 66 | } 67 | 68 | - (CGFloat)sd_width 69 | { 70 | return self.frame.size.width; 71 | } 72 | 73 | - (void)setSd_width:(CGFloat)sd_width 74 | { 75 | CGRect temp = self.frame; 76 | temp.size.width = sd_width; 77 | self.frame = temp; 78 | } 79 | 80 | 81 | - (CGFloat)sd_y 82 | { 83 | return self.frame.origin.y; 84 | } 85 | 86 | - (void)setSd_y:(CGFloat)sd_y 87 | { 88 | CGRect temp = self.frame; 89 | temp.origin.y = sd_y; 90 | self.frame = temp; 91 | } 92 | 93 | - (CGFloat)sd_x 94 | { 95 | return self.frame.origin.x; 96 | } 97 | 98 | - (void)setSd_x:(CGFloat)sd_x 99 | { 100 | CGRect temp = self.frame; 101 | temp.origin.x = sd_x; 102 | self.frame = temp; 103 | } 104 | 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 performance 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 | * disable iCloud backup [defaults to YES] 47 | */ 48 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 49 | 50 | /** 51 | * use memory cache [defaults to YES] 52 | */ 53 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 54 | 55 | /** 56 | * The maximum "total cost" of the in-memory image cache. The cost function is the number of pixels held in memory. 57 | */ 58 | @property (assign, nonatomic) NSUInteger maxMemoryCost; 59 | 60 | /** 61 | * The maximum number of objects the cache should hold. 62 | */ 63 | @property (assign, nonatomic) NSUInteger maxMemoryCountLimit; 64 | 65 | /** 66 | * The maximum length of time to keep an image in the cache, in seconds 67 | */ 68 | @property (assign, nonatomic) NSInteger maxCacheAge; 69 | 70 | /** 71 | * The maximum size of the cache, in bytes. 72 | */ 73 | @property (assign, nonatomic) NSUInteger maxCacheSize; 74 | 75 | /** 76 | * Returns global shared cache instance 77 | * 78 | * @return SDImageCache global instance 79 | */ 80 | + (SDImageCache *)sharedImageCache; 81 | 82 | /** 83 | * Init a new cache store with a specific namespace 84 | * 85 | * @param ns The namespace to use for this cache store 86 | */ 87 | - (id)initWithNamespace:(NSString *)ns; 88 | 89 | /** 90 | * Init a new cache store with a specific namespace and directory 91 | * 92 | * @param ns The namespace to use for this cache store 93 | * @param directory Directory to cache disk images in 94 | */ 95 | - (id)initWithNamespace:(NSString *)ns diskCacheDirectory:(NSString *)directory; 96 | 97 | -(NSString *)makeDiskCachePath:(NSString*)fullNamespace; 98 | 99 | /** 100 | * Add a read-only cache path to search for images pre-cached by SDImageCache 101 | * Useful if you want to bundle pre-loaded images with your app 102 | * 103 | * @param path The path to use for this read-only cache path 104 | */ 105 | - (void)addReadOnlyCachePath:(NSString *)path; 106 | 107 | /** 108 | * Store an image into memory and disk cache at the given key. 109 | * 110 | * @param image The image to store 111 | * @param key The unique image cache key, usually it's image absolute URL 112 | */ 113 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key; 114 | 115 | /** 116 | * Store an image into memory and optionally disk cache at the given key. 117 | * 118 | * @param image The image to store 119 | * @param key The unique image cache key, usually it's image absolute URL 120 | * @param toDisk Store the image to disk cache if YES 121 | */ 122 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk; 123 | 124 | /** 125 | * Store an image into memory and optionally disk cache at the given key. 126 | * 127 | * @param image The image to store 128 | * @param recalculate BOOL indicates if imageData can be used or a new data should be constructed from the UIImage 129 | * @param imageData The image data as returned by the server, this representation will be used for disk storage 130 | * instead of converting the given image object into a storable/compressed image format in order 131 | * to save quality and CPU 132 | * @param key The unique image cache key, usually it's image absolute URL 133 | * @param toDisk Store the image to disk cache if YES 134 | */ 135 | - (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk; 136 | 137 | /** 138 | * Store image NSData into disk cache at the given key. 139 | * 140 | * @param imageData The image data to store 141 | * @param key The unique image cache key, usually it's image absolute URL 142 | */ 143 | - (void)storeImageDataToDisk:(NSData *)imageData forKey:(NSString *)key; 144 | 145 | /** 146 | * Query the disk cache asynchronously. 147 | * 148 | * @param key The unique key used to store the wanted image 149 | */ 150 | - (NSOperation *)queryDiskCacheForKey:(NSString *)key done:(SDWebImageQueryCompletedBlock)doneBlock; 151 | 152 | /** 153 | * Query the memory cache synchronously. 154 | * 155 | * @param key The unique key used to store the wanted image 156 | */ 157 | - (UIImage *)imageFromMemoryCacheForKey:(NSString *)key; 158 | 159 | /** 160 | * Query the disk cache synchronously after checking the memory cache. 161 | * 162 | * @param key The unique key used to store the wanted image 163 | */ 164 | - (UIImage *)imageFromDiskCacheForKey:(NSString *)key; 165 | 166 | /** 167 | * Remove the image from memory and disk cache asynchronously 168 | * 169 | * @param key The unique image cache key 170 | */ 171 | - (void)removeImageForKey:(NSString *)key; 172 | 173 | 174 | /** 175 | * Remove the image from memory and disk cache asynchronously 176 | * 177 | * @param key The unique image cache key 178 | * @param completion An block that should be executed after the image has been removed (optional) 179 | */ 180 | - (void)removeImageForKey:(NSString *)key withCompletion:(SDWebImageNoParamsBlock)completion; 181 | 182 | /** 183 | * Remove the image from memory and optionally disk cache asynchronously 184 | * 185 | * @param key The unique image cache key 186 | * @param fromDisk Also remove cache entry from disk if YES 187 | */ 188 | - (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk; 189 | 190 | /** 191 | * Remove the image from memory and optionally disk cache asynchronously 192 | * 193 | * @param key The unique image cache key 194 | * @param fromDisk Also remove cache entry from disk if YES 195 | * @param completion An block that should be executed after the image has been removed (optional) 196 | */ 197 | - (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(SDWebImageNoParamsBlock)completion; 198 | 199 | /** 200 | * Clear all memory cached images 201 | */ 202 | - (void)clearMemory; 203 | 204 | /** 205 | * Clear all disk cached images. Non-blocking method - returns immediately. 206 | * @param completion An block that should be executed after cache expiration completes (optional) 207 | */ 208 | - (void)clearDiskOnCompletion:(SDWebImageNoParamsBlock)completion; 209 | 210 | /** 211 | * Clear all disk cached images 212 | * @see clearDiskOnCompletion: 213 | */ 214 | - (void)clearDisk; 215 | 216 | /** 217 | * Remove all expired cached image from disk. Non-blocking method - returns immediately. 218 | * @param completionBlock An block that should be executed after cache expiration completes (optional) 219 | */ 220 | - (void)cleanDiskWithCompletionBlock:(SDWebImageNoParamsBlock)completionBlock; 221 | 222 | /** 223 | * Remove all expired cached image from disk 224 | * @see cleanDiskWithCompletionBlock: 225 | */ 226 | - (void)cleanDisk; 227 | 228 | /** 229 | * Get the size used by the disk cache 230 | */ 231 | - (NSUInteger)getSize; 232 | 233 | /** 234 | * Get the number of images in the disk cache 235 | */ 236 | - (NSUInteger)getDiskCount; 237 | 238 | /** 239 | * Asynchronously calculate the disk cache's size. 240 | */ 241 | - (void)calculateSizeWithCompletionBlock:(SDWebImageCalculateSizeBlock)completionBlock; 242 | 243 | /** 244 | * Async check if image exists in disk cache already (does not load the image) 245 | * 246 | * @param key the key describing the url 247 | * @param completionBlock the block to be executed when the check is done. 248 | * @note the completion block will be always executed on the main queue 249 | */ 250 | - (void)diskImageExistsWithKey:(NSString *)key completion:(SDWebImageCheckCacheCompletionBlock)completionBlock; 251 | 252 | /** 253 | * Check if image exists in disk cache already (does not load the image) 254 | * 255 | * @param key the key describing the url 256 | * 257 | * @return YES if an image exists for the given key 258 | */ 259 | - (BOOL)diskImageExistsWithKey:(NSString *)key; 260 | 261 | /** 262 | * Get the cache path for a certain key (needs the cache path root folder) 263 | * 264 | * @param key the key (can be obtained from url using cacheKeyForURL) 265 | * @param path the cache path root folder 266 | * 267 | * @return the cache path 268 | */ 269 | - (NSString *)cachePathForKey:(NSString *)key inPath:(NSString *)path; 270 | 271 | /** 272 | * Get the default cache path for a certain key 273 | * 274 | * @param key the key (can be obtained from url using cacheKeyForURL) 275 | * 276 | * @return the default cache path 277 | */ 278 | - (NSString *)defaultCachePathForKey:(NSString *)key; 279 | 280 | @end 281 | -------------------------------------------------------------------------------- /ADViewDemo/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 Deployment 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 | -------------------------------------------------------------------------------- /ADViewDemo/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; 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 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 | // while downloading huge amount of images 17 | // autorelease the bitmap context 18 | // and all vars to help system to free memory 19 | // when there are memory warning. 20 | // on iOS7, do not forget to call 21 | // [[SDImageCache sharedImageCache] clearMemory]; 22 | 23 | if (image == nil) { // Prevent "CGBitmapContextCreateImage: invalid context 0x0" error 24 | return nil; 25 | } 26 | 27 | @autoreleasepool{ 28 | // do not decode animated images 29 | if (image.images != nil) { 30 | return image; 31 | } 32 | 33 | CGImageRef imageRef = image.CGImage; 34 | 35 | CGImageAlphaInfo alpha = CGImageGetAlphaInfo(imageRef); 36 | BOOL anyAlpha = (alpha == kCGImageAlphaFirst || 37 | alpha == kCGImageAlphaLast || 38 | alpha == kCGImageAlphaPremultipliedFirst || 39 | alpha == kCGImageAlphaPremultipliedLast); 40 | if (anyAlpha) { 41 | return image; 42 | } 43 | 44 | // current 45 | CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(CGImageGetColorSpace(imageRef)); 46 | CGColorSpaceRef colorspaceRef = CGImageGetColorSpace(imageRef); 47 | 48 | BOOL unsupportedColorSpace = (imageColorSpaceModel == kCGColorSpaceModelUnknown || 49 | imageColorSpaceModel == kCGColorSpaceModelMonochrome || 50 | imageColorSpaceModel == kCGColorSpaceModelCMYK || 51 | imageColorSpaceModel == kCGColorSpaceModelIndexed); 52 | if (unsupportedColorSpace) { 53 | colorspaceRef = CGColorSpaceCreateDeviceRGB(); 54 | } 55 | 56 | size_t width = CGImageGetWidth(imageRef); 57 | size_t height = CGImageGetHeight(imageRef); 58 | NSUInteger bytesPerPixel = 4; 59 | NSUInteger bytesPerRow = bytesPerPixel * width; 60 | NSUInteger bitsPerComponent = 8; 61 | 62 | 63 | // kCGImageAlphaNone is not supported in CGBitmapContextCreate. 64 | // Since the original image here has no alpha info, use kCGImageAlphaNoneSkipLast 65 | // to create bitmap graphics contexts without alpha info. 66 | CGContextRef context = CGBitmapContextCreate(NULL, 67 | width, 68 | height, 69 | bitsPerComponent, 70 | bytesPerRow, 71 | colorspaceRef, 72 | kCGBitmapByteOrderDefault|kCGImageAlphaNoneSkipLast); 73 | 74 | // Draw the image into the context and retrieve the new bitmap image without alpha 75 | CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); 76 | CGImageRef imageRefWithoutAlpha = CGBitmapContextCreateImage(context); 77 | UIImage *imageWithoutAlpha = [UIImage imageWithCGImage:imageRefWithoutAlpha 78 | scale:image.scale 79 | orientation:image.imageOrientation]; 80 | 81 | if (unsupportedColorSpace) { 82 | CGColorSpaceRelease(colorspaceRef); 83 | } 84 | 85 | CGContextRelease(context); 86 | CGImageRelease(imageRefWithoutAlpha); 87 | 88 | return imageWithoutAlpha; 89 | } 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /ADViewDemo/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 use 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 certificates. 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 performance 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 the default URL credential to be set for request operations. 114 | */ 115 | @property (strong, nonatomic) NSURLCredential *urlCredential; 116 | 117 | /** 118 | * Set username 119 | */ 120 | @property (strong, nonatomic) NSString *username; 121 | 122 | /** 123 | * Set password 124 | */ 125 | @property (strong, nonatomic) NSString *password; 126 | 127 | /** 128 | * Set filter to pick headers for downloading image HTTP request. 129 | * 130 | * This block will be invoked for each downloading image request, returned 131 | * NSDictionary will be used as headers in corresponding HTTP request. 132 | */ 133 | @property (nonatomic, copy) SDWebImageDownloaderHeadersFilterBlock headersFilter; 134 | 135 | /** 136 | * Set a value for a HTTP header to be appended to each download HTTP request. 137 | * 138 | * @param value The value for the header field. Use `nil` value to remove the header. 139 | * @param field The name of the header field to set. 140 | */ 141 | - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field; 142 | 143 | /** 144 | * Returns the value of the specified HTTP header field. 145 | * 146 | * @return The value associated with the header field field, or `nil` if there is no corresponding header field. 147 | */ 148 | - (NSString *)valueForHTTPHeaderField:(NSString *)field; 149 | 150 | /** 151 | * Sets a subclass of `SDWebImageDownloaderOperation` as the default 152 | * `NSOperation` to be used each time SDWebImage constructs a request 153 | * operation to download an image. 154 | * 155 | * @param operationClass The subclass of `SDWebImageDownloaderOperation` to set 156 | * as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. 157 | */ 158 | - (void)setOperationClass:(Class)operationClass; 159 | 160 | /** 161 | * Creates a SDWebImageDownloader async downloader instance with a given URL 162 | * 163 | * The delegate will be informed when the image is finish downloaded or an error has happen. 164 | * 165 | * @see SDWebImageDownloaderDelegate 166 | * 167 | * @param url The URL to the image to download 168 | * @param options The options to be used for this download 169 | * @param progressBlock A block called repeatedly while the image is downloading 170 | * @param completedBlock A block called once the download is completed. 171 | * If the download succeeded, the image parameter is set, in case of error, 172 | * error parameter is set with the error. The last parameter is always YES 173 | * if SDWebImageDownloaderProgressiveDownload isn't use. With the 174 | * SDWebImageDownloaderProgressiveDownload option, this block is called 175 | * repeatedly with the partial image object and the finished argument set to NO 176 | * before to be called a last time with the full image and finished argument 177 | * set to YES. In case of error, the finished argument is always YES. 178 | * 179 | * @return A cancellable SDWebImageOperation 180 | */ 181 | - (id )downloadImageWithURL:(NSURL *)url 182 | options:(SDWebImageDownloaderOptions)options 183 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 184 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock; 185 | 186 | /** 187 | * Sets the download queue suspension state 188 | */ 189 | - (void)setSuspended:(BOOL)suspended; 190 | 191 | /** 192 | * Cancels all download operations in the queue 193 | */ 194 | - (void)cancelAllDownloads; 195 | 196 | @end 197 | -------------------------------------------------------------------------------- /ADViewDemo/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 task. 22 | */ 23 | @property (strong, nonatomic, readonly) NSURLRequest *request; 24 | 25 | /** 26 | * The operation's task 27 | */ 28 | @property (strong, nonatomic, readonly) NSURLSessionTask *dataTask; 29 | 30 | 31 | @property (assign, nonatomic) BOOL shouldDecompressImages; 32 | 33 | /** 34 | * Was used to determine whether the URL connection should consult the credential storage for authenticating the connection. 35 | * @deprecated Not used for a couple of versions 36 | */ 37 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility"); 38 | 39 | /** 40 | * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. 41 | * 42 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 43 | */ 44 | @property (nonatomic, strong) NSURLCredential *credential; 45 | 46 | /** 47 | * The SDWebImageDownloaderOptions for the receiver. 48 | */ 49 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 50 | 51 | /** 52 | * The expected size of data. 53 | */ 54 | @property (assign, nonatomic) NSInteger expectedSize; 55 | 56 | /** 57 | * The response returned by the operation's connection. 58 | */ 59 | @property (strong, nonatomic) NSURLResponse *response; 60 | 61 | /** 62 | * Initializes a `SDWebImageDownloaderOperation` object 63 | * 64 | * @see SDWebImageDownloaderOperation 65 | * 66 | * @param request the URL request 67 | * @param session the URL session in which this operation will run 68 | * @param options downloader options 69 | * @param progressBlock the block executed when a new chunk of data arrives. 70 | * @note the progress block is executed on a background queue 71 | * @param completedBlock the block executed when the download is done. 72 | * @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 73 | * @param cancelBlock the block executed if the download (operation) is cancelled 74 | * 75 | * @return the initialized instance 76 | */ 77 | - (id)initWithRequest:(NSURLRequest *)request 78 | inSession:(NSURLSession *)session 79 | options:(SDWebImageDownloaderOptions)options 80 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 81 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock 82 | cancelled:(SDWebImageNoParamsBlock)cancelBlock; 83 | 84 | /** 85 | * Initializes a `SDWebImageDownloaderOperation` object 86 | * 87 | * @see SDWebImageDownloaderOperation 88 | * 89 | * @param request the URL request 90 | * @param options downloader options 91 | * @param progressBlock the block executed when a new chunk of data arrives. 92 | * @note the progress block is executed on a background queue 93 | * @param completedBlock the block executed when the download is done. 94 | * @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 95 | * @param cancelBlock the block executed if the download (operation) is cancelled 96 | * 97 | * @return the initialized instance. The operation will run in a separate session created for this operation 98 | */ 99 | - (id)initWithRequest:(NSURLRequest *)request 100 | options:(SDWebImageDownloaderOptions)options 101 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 102 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock 103 | cancelled:(SDWebImageNoParamsBlock)cancelBlock 104 | __deprecated_msg("Method deprecated. Use `initWithRequest:inSession:options:progress:completed:cancelled`"); 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDWebImage/SDWebImage/SDWebImageManager.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 "SDWebImageOperation.h" 11 | #import "SDWebImageDownloader.h" 12 | #import "SDImageCache.h" 13 | 14 | typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { 15 | /** 16 | * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. 17 | * This flag disable this blacklisting. 18 | */ 19 | SDWebImageRetryFailed = 1 << 0, 20 | 21 | /** 22 | * By default, image downloads are started during UI interactions, this flags disable this feature, 23 | * leading to delayed download on UIScrollView deceleration for instance. 24 | */ 25 | SDWebImageLowPriority = 1 << 1, 26 | 27 | /** 28 | * This flag disables on-disk caching 29 | */ 30 | SDWebImageCacheMemoryOnly = 1 << 2, 31 | 32 | /** 33 | * This flag enables progressive download, the image is displayed progressively during download as a browser would do. 34 | * By default, the image is only displayed once completely downloaded. 35 | */ 36 | SDWebImageProgressiveDownload = 1 << 3, 37 | 38 | /** 39 | * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed. 40 | * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation. 41 | * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics. 42 | * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image. 43 | * 44 | * Use this flag only if you can't make your URLs static with embedded cache busting parameter. 45 | */ 46 | SDWebImageRefreshCached = 1 << 4, 47 | 48 | /** 49 | * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for 50 | * extra time in background to let the request finish. If the background task expires the operation will be cancelled. 51 | */ 52 | SDWebImageContinueInBackground = 1 << 5, 53 | 54 | /** 55 | * Handles cookies stored in NSHTTPCookieStore by setting 56 | * NSMutableURLRequest.HTTPShouldHandleCookies = YES; 57 | */ 58 | SDWebImageHandleCookies = 1 << 6, 59 | 60 | /** 61 | * Enable to allow untrusted SSL certificates. 62 | * Useful for testing purposes. Use with caution in production. 63 | */ 64 | SDWebImageAllowInvalidSSLCertificates = 1 << 7, 65 | 66 | /** 67 | * By default, images are loaded in the order in which they were queued. This flag moves them to 68 | * the front of the queue. 69 | */ 70 | SDWebImageHighPriority = 1 << 8, 71 | 72 | /** 73 | * By default, placeholder images are loaded while the image is loading. This flag will delay the loading 74 | * of the placeholder image until after the image has finished loading. 75 | */ 76 | SDWebImageDelayPlaceholder = 1 << 9, 77 | 78 | /** 79 | * We usually don't call transformDownloadedImage delegate method on animated images, 80 | * as most transformation code would mangle it. 81 | * Use this flag to transform them anyway. 82 | */ 83 | SDWebImageTransformAnimatedImage = 1 << 10, 84 | 85 | /** 86 | * By default, image is added to the imageView after download. But in some cases, we want to 87 | * have the hand before setting the image (apply a filter or add it with cross-fade animation for instance) 88 | * Use this flag if you want to manually set the image in the completion when success 89 | */ 90 | SDWebImageAvoidAutoSetImage = 1 << 11 91 | }; 92 | 93 | typedef void(^SDWebImageCompletionBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL); 94 | 95 | typedef void(^SDWebImageCompletionWithFinishedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL); 96 | 97 | typedef NSString *(^SDWebImageCacheKeyFilterBlock)(NSURL *url); 98 | 99 | 100 | @class SDWebImageManager; 101 | 102 | @protocol SDWebImageManagerDelegate 103 | 104 | @optional 105 | 106 | /** 107 | * Controls which image should be downloaded when the image is not found in the cache. 108 | * 109 | * @param imageManager The current `SDWebImageManager` 110 | * @param imageURL The url of the image to be downloaded 111 | * 112 | * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied. 113 | */ 114 | - (BOOL)imageManager:(SDWebImageManager *)imageManager shouldDownloadImageForURL:(NSURL *)imageURL; 115 | 116 | /** 117 | * Allows to transform the image immediately after it has been downloaded and just before to cache it on disk and memory. 118 | * NOTE: This method is called from a global queue in order to not to block the main thread. 119 | * 120 | * @param imageManager The current `SDWebImageManager` 121 | * @param image The image to transform 122 | * @param imageURL The url of the image to transform 123 | * 124 | * @return The transformed image object. 125 | */ 126 | - (UIImage *)imageManager:(SDWebImageManager *)imageManager transformDownloadedImage:(UIImage *)image withURL:(NSURL *)imageURL; 127 | 128 | @end 129 | 130 | /** 131 | * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes. 132 | * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache). 133 | * You can use this class directly to benefit from web image downloading with caching in another context than 134 | * a UIView. 135 | * 136 | * Here is a simple example of how to use SDWebImageManager: 137 | * 138 | * @code 139 | 140 | SDWebImageManager *manager = [SDWebImageManager sharedManager]; 141 | [manager downloadImageWithURL:imageURL 142 | options:0 143 | progress:nil 144 | completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 145 | if (image) { 146 | // do something with image 147 | } 148 | }]; 149 | 150 | * @endcode 151 | */ 152 | @interface SDWebImageManager : NSObject 153 | 154 | @property (weak, nonatomic) id delegate; 155 | 156 | @property (strong, nonatomic, readonly) SDImageCache *imageCache; 157 | @property (strong, nonatomic, readonly) SDWebImageDownloader *imageDownloader; 158 | 159 | /** 160 | * The cache filter is a block used each time SDWebImageManager need to convert an URL into a cache key. This can 161 | * be used to remove dynamic part of an image URL. 162 | * 163 | * The following example sets a filter in the application delegate that will remove any query-string from the 164 | * URL before to use it as a cache key: 165 | * 166 | * @code 167 | 168 | [[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) { 169 | url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; 170 | return [url absoluteString]; 171 | }]; 172 | 173 | * @endcode 174 | */ 175 | @property (nonatomic, copy) SDWebImageCacheKeyFilterBlock cacheKeyFilter; 176 | 177 | /** 178 | * Returns global SDWebImageManager instance. 179 | * 180 | * @return SDWebImageManager shared instance 181 | */ 182 | + (SDWebImageManager *)sharedManager; 183 | 184 | /** 185 | * Allows to specify instance of cache and image downloader used with image manager. 186 | * @return new instance of `SDWebImageManager` with specified cache and downloader. 187 | */ 188 | - (instancetype)initWithCache:(SDImageCache *)cache downloader:(SDWebImageDownloader *)downloader; 189 | 190 | /** 191 | * Downloads the image at the given URL if not present in cache or return the cached version otherwise. 192 | * 193 | * @param url The URL to the image 194 | * @param options A mask to specify options to use for this request 195 | * @param progressBlock A block called while image is downloading 196 | * @param completedBlock A block called when operation has been completed. 197 | * 198 | * This parameter is required. 199 | * 200 | * This block has no return value and takes the requested UIImage as first parameter. 201 | * In case of error the image parameter is nil and the second parameter may contain an NSError. 202 | * 203 | * The third parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache 204 | * or from the memory cache or from the network. 205 | * 206 | * The last parameter is set to NO when the SDWebImageProgressiveDownload option is used and the image is 207 | * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the 208 | * block is called a last time with the full image and the last parameter set to YES. 209 | * 210 | * @return Returns an NSObject conforming to SDWebImageOperation. Should be an instance of SDWebImageDownloaderOperation 211 | */ 212 | - (id )downloadImageWithURL:(NSURL *)url 213 | options:(SDWebImageOptions)options 214 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 215 | completed:(SDWebImageCompletionWithFinishedBlock)completedBlock; 216 | 217 | /** 218 | * Saves image to cache for given URL 219 | * 220 | * @param image The image to cache 221 | * @param url The URL to the image 222 | * 223 | */ 224 | 225 | - (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url; 226 | 227 | /** 228 | * Cancel all current operations 229 | */ 230 | - (void)cancelAll; 231 | 232 | /** 233 | * Check one or more operations running 234 | */ 235 | - (BOOL)isRunning; 236 | 237 | /** 238 | * Check if image has already been cached 239 | * 240 | * @param url image url 241 | * 242 | * @return if the image was already cached 243 | */ 244 | - (BOOL)cachedImageExistsForURL:(NSURL *)url; 245 | 246 | /** 247 | * Check if image has already been cached on disk only 248 | * 249 | * @param url image url 250 | * 251 | * @return if the image was already cached (disk only) 252 | */ 253 | - (BOOL)diskImageExistsForURL:(NSURL *)url; 254 | 255 | /** 256 | * Async check if image has already been cached 257 | * 258 | * @param url image url 259 | * @param completionBlock the block to be executed when the check is finished 260 | * 261 | * @note the completion block is always executed on the main queue 262 | */ 263 | - (void)cachedImageExistsForURL:(NSURL *)url 264 | completion:(SDWebImageCheckCacheCompletionBlock)completionBlock; 265 | 266 | /** 267 | * Async check if image has already been cached on disk only 268 | * 269 | * @param url image url 270 | * @param completionBlock the block to be executed when the check is finished 271 | * 272 | * @note the completion block is always executed on the main queue 273 | */ 274 | - (void)diskImageExistsForURL:(NSURL *)url 275 | completion:(SDWebImageCheckCacheCompletionBlock)completionBlock; 276 | 277 | 278 | /** 279 | *Return the cache key for a given URL 280 | */ 281 | - (NSString *)cacheKeyForURL:(NSURL *)url; 282 | 283 | @end 284 | 285 | 286 | #pragma mark - Deprecated 287 | 288 | typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType) __deprecated_msg("Block type deprecated. Use `SDWebImageCompletionBlock`"); 289 | typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) __deprecated_msg("Block type deprecated. Use `SDWebImageCompletionWithFinishedBlock`"); 290 | 291 | 292 | @interface SDWebImageManager (Deprecated) 293 | 294 | /** 295 | * Downloads the image at the given URL if not present in cache or return the cached version otherwise. 296 | * 297 | * @deprecated This method has been deprecated. Use `downloadImageWithURL:options:progress:completed:` 298 | */ 299 | - (id )downloadWithURL:(NSURL *)url 300 | options:(SDWebImageOptions)options 301 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 302 | completed:(SDWebImageCompletedWithFinishedBlock)completedBlock __deprecated_msg("Method deprecated. Use `downloadImageWithURL:options:progress:completed:`"); 303 | 304 | @end 305 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched (successful or not) 24 | * @param totalCount The total number of images that were to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(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 | * Allows you to instantiate a prefetcher with any arbitrary image manager. 75 | */ 76 | - (id)initWithImageManager:(SDWebImageManager *)manager; 77 | 78 | /** 79 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 80 | * currently one image is downloaded at a time, 81 | * and skips images for failed downloads and proceed to the next image in the list 82 | * 83 | * @param urls list of URLs to prefetch 84 | */ 85 | - (void)prefetchURLs:(NSArray *)urls; 86 | 87 | /** 88 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 89 | * currently one image is downloaded at a time, 90 | * and skips images for failed downloads and proceed to the next image in the list 91 | * 92 | * @param urls list of URLs to prefetch 93 | * @param progressBlock block to be called when progress updates; 94 | * first parameter is the number of completed (successful or not) requests, 95 | * second parameter is the total number of images originally requested to be prefetched 96 | * @param completionBlock block to be called when prefetching is completed 97 | * first param is the number of completed (successful or not) requests, 98 | * second parameter is the number of skipped requests 99 | */ 100 | - (void)prefetchURLs:(NSArray *)urls progress:(SDWebImagePrefetcherProgressBlock)progressBlock completed:(SDWebImagePrefetcherCompletionBlock)completionBlock; 101 | 102 | /** 103 | * Remove and cancel queued list 104 | */ 105 | - (void)cancelPrefetching; 106 | 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImagePrefetcher.h" 10 | 11 | @interface SDWebImagePrefetcher () 12 | 13 | @property (strong, nonatomic) SDWebImageManager *manager; 14 | @property (strong, nonatomic) NSArray *prefetchURLs; 15 | @property (assign, nonatomic) NSUInteger requestedCount; 16 | @property (assign, nonatomic) NSUInteger skippedCount; 17 | @property (assign, nonatomic) NSUInteger finishedCount; 18 | @property (assign, nonatomic) NSTimeInterval startedTime; 19 | @property (copy, nonatomic) SDWebImagePrefetcherCompletionBlock completionBlock; 20 | @property (copy, nonatomic) SDWebImagePrefetcherProgressBlock progressBlock; 21 | 22 | @end 23 | 24 | @implementation SDWebImagePrefetcher 25 | 26 | + (SDWebImagePrefetcher *)sharedImagePrefetcher { 27 | static dispatch_once_t once; 28 | static id instance; 29 | dispatch_once(&once, ^{ 30 | instance = [self new]; 31 | }); 32 | return instance; 33 | } 34 | 35 | - (id)init { 36 | return [self initWithImageManager:[SDWebImageManager new]]; 37 | } 38 | 39 | - (id)initWithImageManager:(SDWebImageManager *)manager { 40 | if ((self = [super init])) { 41 | _manager = manager; 42 | _options = SDWebImageLowPriority; 43 | _prefetcherQueue = dispatch_get_main_queue(); 44 | self.maxConcurrentDownloads = 3; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { 50 | self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; 51 | } 52 | 53 | - (NSUInteger)maxConcurrentDownloads { 54 | return self.manager.imageDownloader.maxConcurrentDownloads; 55 | } 56 | 57 | - (void)startPrefetchingAtIndex:(NSUInteger)index { 58 | if (index >= self.prefetchURLs.count) return; 59 | self.requestedCount++; 60 | [self.manager 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 | } 69 | else { 70 | if (self.progressBlock) { 71 | self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 72 | } 73 | // Add last failed 74 | self.skippedCount++; 75 | } 76 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 77 | [self.delegate imagePrefetcher:self 78 | didPrefetchURL:self.prefetchURLs[index] 79 | finishedCount:self.finishedCount 80 | totalCount:self.prefetchURLs.count 81 | ]; 82 | } 83 | if (self.prefetchURLs.count > self.requestedCount) { 84 | dispatch_async(self.prefetcherQueue, ^{ 85 | [self startPrefetchingAtIndex:self.requestedCount]; 86 | }); 87 | } else if (self.finishedCount == self.requestedCount) { 88 | [self reportStatus]; 89 | if (self.completionBlock) { 90 | self.completionBlock(self.finishedCount, self.skippedCount); 91 | self.completionBlock = nil; 92 | } 93 | self.progressBlock = nil; 94 | } 95 | }]; 96 | } 97 | 98 | - (void)reportStatus { 99 | NSUInteger total = [self.prefetchURLs count]; 100 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 101 | [self.delegate imagePrefetcher:self 102 | didFinishWithTotalCount:(total - self.skippedCount) 103 | skippedCount:self.skippedCount 104 | ]; 105 | } 106 | } 107 | 108 | - (void)prefetchURLs:(NSArray *)urls { 109 | [self prefetchURLs:urls progress:nil completed:nil]; 110 | } 111 | 112 | - (void)prefetchURLs:(NSArray *)urls progress:(SDWebImagePrefetcherProgressBlock)progressBlock completed:(SDWebImagePrefetcherCompletionBlock)completionBlock { 113 | [self cancelPrefetching]; // Prevent duplicate prefetch request 114 | self.startedTime = CFAbsoluteTimeGetCurrent(); 115 | self.prefetchURLs = urls; 116 | self.completionBlock = completionBlock; 117 | self.progressBlock = progressBlock; 118 | 119 | if (urls.count == 0) { 120 | if (completionBlock) { 121 | completionBlock(0,0); 122 | } 123 | } else { 124 | // Starts prefetching from the very first image on the list with the max allowed concurrency 125 | NSUInteger listCount = self.prefetchURLs.count; 126 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 127 | [self startPrefetchingAtIndex:i]; 128 | } 129 | } 130 | } 131 | 132 | - (void)cancelPrefetching { 133 | self.prefetchURLs = nil; 134 | self.skippedCount = 0; 135 | self.requestedCount = 0; 136 | self.finishedCount = 0; 137 | [self.manager cancelAll]; 138 | } 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/SDWebImage/SDWebImage/UIButton+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 "UIButton+WebCache.h" 10 | #import "objc/runtime.h" 11 | #import "UIView+WebCacheOperation.h" 12 | 13 | static char imageURLStorageKey; 14 | 15 | @implementation UIButton (WebCache) 16 | 17 | - (NSURL *)sd_currentImageURL { 18 | NSURL *url = self.imageURLStorage[@(self.state)]; 19 | 20 | if (!url) { 21 | url = self.imageURLStorage[@(UIControlStateNormal)]; 22 | } 23 | 24 | return url; 25 | } 26 | 27 | - (NSURL *)sd_imageURLForState:(UIControlState)state { 28 | return self.imageURLStorage[@(state)]; 29 | } 30 | 31 | - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state { 32 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 33 | } 34 | 35 | - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder { 36 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 37 | } 38 | 39 | - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options { 40 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 41 | } 42 | 43 | - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletionBlock)completedBlock { 44 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; 45 | } 46 | 47 | - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock { 48 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; 49 | } 50 | 51 | - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { 52 | 53 | [self setImage:placeholder forState:state]; 54 | [self sd_cancelImageLoadForState:state]; 55 | 56 | if (!url) { 57 | [self.imageURLStorage removeObjectForKey:@(state)]; 58 | 59 | dispatch_main_async_safe(^{ 60 | if (completedBlock) { 61 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 62 | completedBlock(nil, error, SDImageCacheTypeNone, url); 63 | } 64 | }); 65 | 66 | return; 67 | } 68 | 69 | self.imageURLStorage[@(state)] = url; 70 | 71 | __weak __typeof(self)wself = self; 72 | id operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 73 | if (!wself) return; 74 | dispatch_main_sync_safe(^{ 75 | __strong UIButton *sself = wself; 76 | if (!sself) return; 77 | if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) 78 | { 79 | completedBlock(image, error, cacheType, url); 80 | return; 81 | } 82 | else if (image) { 83 | [sself setImage:image forState:state]; 84 | } 85 | if (completedBlock && finished) { 86 | completedBlock(image, error, cacheType, url); 87 | } 88 | }); 89 | }]; 90 | [self sd_setImageLoadOperation:operation forState:state]; 91 | } 92 | 93 | - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state { 94 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 95 | } 96 | 97 | - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder { 98 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 99 | } 100 | 101 | - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options { 102 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 103 | } 104 | 105 | - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletionBlock)completedBlock { 106 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; 107 | } 108 | 109 | - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock { 110 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; 111 | } 112 | 113 | - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { 114 | [self sd_cancelBackgroundImageLoadForState:state]; 115 | 116 | [self setBackgroundImage:placeholder forState:state]; 117 | 118 | if (url) { 119 | __weak __typeof(self)wself = self; 120 | id operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 121 | if (!wself) return; 122 | dispatch_main_sync_safe(^{ 123 | __strong UIButton *sself = wself; 124 | if (!sself) return; 125 | if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) 126 | { 127 | completedBlock(image, error, cacheType, url); 128 | return; 129 | } 130 | else if (image) { 131 | [sself setBackgroundImage:image forState:state]; 132 | } 133 | if (completedBlock && finished) { 134 | completedBlock(image, error, cacheType, url); 135 | } 136 | }); 137 | }]; 138 | [self sd_setBackgroundImageLoadOperation:operation forState:state]; 139 | } else { 140 | dispatch_main_async_safe(^{ 141 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 142 | if (completedBlock) { 143 | completedBlock(nil, error, SDImageCacheTypeNone, url); 144 | } 145 | }); 146 | } 147 | } 148 | 149 | - (void)sd_setImageLoadOperation:(id)operation forState:(UIControlState)state { 150 | [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; 151 | } 152 | 153 | - (void)sd_cancelImageLoadForState:(UIControlState)state { 154 | [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; 155 | } 156 | 157 | - (void)sd_setBackgroundImageLoadOperation:(id)operation forState:(UIControlState)state { 158 | [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; 159 | } 160 | 161 | - (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { 162 | [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; 163 | } 164 | 165 | - (NSMutableDictionary *)imageURLStorage { 166 | NSMutableDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey); 167 | if (!storage) 168 | { 169 | storage = [NSMutableDictionary dictionary]; 170 | objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 171 | } 172 | 173 | return storage; 174 | } 175 | 176 | @end 177 | 178 | 179 | @implementation UIButton (WebCacheDeprecated) 180 | 181 | - (NSURL *)currentImageURL { 182 | return [self sd_currentImageURL]; 183 | } 184 | 185 | - (NSURL *)imageURLForState:(UIControlState)state { 186 | return [self sd_imageURLForState:state]; 187 | } 188 | 189 | - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state { 190 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 191 | } 192 | 193 | - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder { 194 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 195 | } 196 | 197 | - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options { 198 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 199 | } 200 | 201 | - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock { 202 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 203 | if (completedBlock) { 204 | completedBlock(image, error, cacheType); 205 | } 206 | }]; 207 | } 208 | 209 | - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock { 210 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 211 | if (completedBlock) { 212 | completedBlock(image, error, cacheType); 213 | } 214 | }]; 215 | } 216 | 217 | - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { 218 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 219 | if (completedBlock) { 220 | completedBlock(image, error, cacheType); 221 | } 222 | }]; 223 | } 224 | 225 | - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state { 226 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 227 | } 228 | 229 | - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder { 230 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 231 | } 232 | 233 | - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options { 234 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 235 | } 236 | 237 | - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock { 238 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 239 | if (completedBlock) { 240 | completedBlock(image, error, cacheType); 241 | } 242 | }]; 243 | } 244 | 245 | - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock { 246 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 247 | if (completedBlock) { 248 | completedBlock(image, error, cacheType); 249 | } 250 | }]; 251 | } 252 | 253 | - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { 254 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 255 | if (completedBlock) { 256 | completedBlock(image, error, cacheType); 257 | } 258 | }]; 259 | } 260 | 261 | - (void)cancelCurrentImageLoad { 262 | // in a backwards compatible manner, cancel for current state 263 | [self sd_cancelImageLoadForState:self.state]; 264 | } 265 | 266 | - (void)cancelBackgroundImageLoadForState:(UIControlState)state { 267 | [self sd_cancelBackgroundImageLoadForState:state]; 268 | } 269 | 270 | @end 271 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 | if (!image) { 36 | continue; 37 | } 38 | 39 | duration += [self sd_frameDurationAtIndex:i source:source]; 40 | 41 | [images addObject:[UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]]; 42 | 43 | CGImageRelease(image); 44 | } 45 | 46 | if (!duration) { 47 | duration = (1.0f / 10.0f) * count; 48 | } 49 | 50 | animatedImage = [UIImage animatedImageWithImages:images duration:duration]; 51 | } 52 | 53 | CFRelease(source); 54 | 55 | return animatedImage; 56 | } 57 | 58 | + (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { 59 | float frameDuration = 0.1f; 60 | CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); 61 | NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; 62 | NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary]; 63 | 64 | NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime]; 65 | if (delayTimeUnclampedProp) { 66 | frameDuration = [delayTimeUnclampedProp floatValue]; 67 | } 68 | else { 69 | 70 | NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime]; 71 | if (delayTimeProp) { 72 | frameDuration = [delayTimeProp floatValue]; 73 | } 74 | } 75 | 76 | // Many annoying ads specify a 0 duration to make an image flash as quickly as possible. 77 | // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify 78 | // a duration of <= 10 ms. See and 79 | // for more information. 80 | 81 | if (frameDuration < 0.011f) { 82 | frameDuration = 0.100f; 83 | } 84 | 85 | CFRelease(cfFrameProperties); 86 | return frameDuration; 87 | } 88 | 89 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name { 90 | CGFloat scale = [UIScreen mainScreen].scale; 91 | 92 | if (scale > 1.0f) { 93 | NSString *retinaPath = [[NSBundle mainBundle] pathForResource:[name stringByAppendingString:@"@2x"] ofType:@"gif"]; 94 | 95 | NSData *data = [NSData dataWithContentsOfFile:retinaPath]; 96 | 97 | if (data) { 98 | return [UIImage sd_animatedGIFWithData:data]; 99 | } 100 | 101 | NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; 102 | 103 | data = [NSData dataWithContentsOfFile:path]; 104 | 105 | if (data) { 106 | return [UIImage sd_animatedGIFWithData:data]; 107 | } 108 | 109 | return [UIImage imageNamed:name]; 110 | } 111 | else { 112 | NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; 113 | 114 | NSData *data = [NSData dataWithContentsOfFile:path]; 115 | 116 | if (data) { 117 | return [UIImage sd_animatedGIFWithData:data]; 118 | } 119 | 120 | return [UIImage imageNamed:name]; 121 | } 122 | } 123 | 124 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size { 125 | if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero)) { 126 | return self; 127 | } 128 | 129 | CGSize scaledSize = size; 130 | CGPoint thumbnailPoint = CGPointZero; 131 | 132 | CGFloat widthFactor = size.width / self.size.width; 133 | CGFloat heightFactor = size.height / self.size.height; 134 | CGFloat scaleFactor = (widthFactor > heightFactor) ? widthFactor : heightFactor; 135 | scaledSize.width = self.size.width * scaleFactor; 136 | scaledSize.height = self.size.height * scaleFactor; 137 | 138 | if (widthFactor > heightFactor) { 139 | thumbnailPoint.y = (size.height - scaledSize.height) * 0.5; 140 | } 141 | else if (widthFactor < heightFactor) { 142 | thumbnailPoint.x = (size.width - scaledSize.width) * 0.5; 143 | } 144 | 145 | NSMutableArray *scaledImages = [NSMutableArray array]; 146 | 147 | for (UIImage *image in self.images) { 148 | UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); 149 | 150 | [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; 151 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 152 | 153 | [scaledImages addObject:newImage]; 154 | 155 | UIGraphicsEndImageContext(); 156 | } 157 | 158 | return [UIImage animatedImageWithImages:scaledImages duration:self.duration]; 159 | } 160 | 161 | @end 162 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 retrieved 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 retrieved 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 retrieved 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 | -------------------------------------------------------------------------------- /ADViewDemo/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 && (options & SDWebImageAvoidAutoSetImage) && completedBlock) 43 | { 44 | completedBlock(image, error, cacheType, url); 45 | return; 46 | } 47 | else if (image) { 48 | wself.highlightedImage = image; 49 | [wself setNeedsLayout]; 50 | } 51 | if (completedBlock && finished) { 52 | completedBlock(image, error, cacheType, url); 53 | } 54 | }); 55 | }]; 56 | [self sd_setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey]; 57 | } else { 58 | dispatch_main_async_safe(^{ 59 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 60 | if (completedBlock) { 61 | completedBlock(nil, error, SDImageCacheTypeNone, url); 62 | } 63 | }); 64 | } 65 | } 66 | 67 | - (void)sd_cancelCurrentHighlightedImageLoad { 68 | [self sd_cancelImageLoadOperationWithKey:UIImageViewHighlightedWebCacheOperationKey]; 69 | } 70 | 71 | @end 72 | 73 | 74 | @implementation UIImageView (HighlightedWebCacheDeprecated) 75 | 76 | - (void)setHighlightedImageWithURL:(NSURL *)url { 77 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 78 | } 79 | 80 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options { 81 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 82 | } 83 | 84 | - (void)setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock { 85 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 86 | if (completedBlock) { 87 | completedBlock(image, error, cacheType); 88 | } 89 | }]; 90 | } 91 | 92 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { 93 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 94 | if (completedBlock) { 95 | completedBlock(image, error, cacheType); 96 | } 97 | }]; 98 | } 99 | 100 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock { 101 | [self sd_setHighlightedImageWithURL:url options:0 progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 102 | if (completedBlock) { 103 | completedBlock(image, error, cacheType); 104 | } 105 | }]; 106 | } 107 | 108 | - (void)cancelCurrentHighlightedImageLoad { 109 | [self sd_cancelCurrentHighlightedImageLoad]; 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /ADViewDemo/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 retrieved 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 retrieved 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 retrieved 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 retrieved 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 optionally a 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 retrieved from the local cache or from the network. 161 | * The fourth parameter is the original image url. 162 | */ 163 | - (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url placeholderImage:(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 | /** 180 | * Show activity UIActivityIndicatorView 181 | */ 182 | - (void)setShowActivityIndicatorView:(BOOL)show; 183 | 184 | /** 185 | * set desired UIActivityIndicatorViewStyle 186 | * 187 | * @param style The style of the UIActivityIndicatorView 188 | */ 189 | - (void)setIndicatorStyle:(UIActivityIndicatorViewStyle)style; 190 | 191 | @end 192 | 193 | 194 | @interface UIImageView (WebCacheDeprecated) 195 | 196 | - (NSURL *)imageURL __deprecated_msg("Use `sd_imageURL`"); 197 | 198 | - (void)setImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:`"); 199 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:`"); 200 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options`"); 201 | 202 | - (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:completed:`"); 203 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:completed:`"); 204 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:completed:`"); 205 | - (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:`"); 206 | 207 | - (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithPreviousCachedImageWithURL:placeholderImage:options:progress:completed:`"); 208 | 209 | - (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs __deprecated_msg("Use `sd_setAnimationImagesWithURLs:`"); 210 | 211 | - (void)cancelCurrentArrayLoad __deprecated_msg("Use `sd_cancelCurrentAnimationImagesLoad`"); 212 | 213 | - (void)cancelCurrentImageLoad __deprecated_msg("Use `sd_cancelCurrentImageLoad`"); 214 | 215 | @end 216 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/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 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## SDCycleScrollView 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2015 GSD_iOS 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | 30 | ## SDWebImage 31 | 32 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com 33 | 34 | Permission is hereby granted, free of charge, to any person obtaining a copy 35 | of this software and associated documentation files (the "Software"), to deal 36 | in the Software without restriction, including without limitation the rights 37 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 38 | copies of the Software, and to permit persons to whom the Software is furnished 39 | to do so, subject to the following conditions: 40 | 41 | The above copyright notice and this permission notice shall be included in all 42 | copies or substantial portions of the Software. 43 | 44 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 45 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 46 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 47 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 48 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 49 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 50 | THE SOFTWARE. 51 | 52 | 53 | Generated by CocoaPods - https://cocoapods.org 54 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo-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 | The MIT License (MIT) 18 | 19 | Copyright (c) 2015 GSD_iOS 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | 40 | Title 41 | SDCycleScrollView 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com 48 | 49 | Permission is hereby granted, free of charge, to any person obtaining a copy 50 | of this software and associated documentation files (the "Software"), to deal 51 | in the Software without restriction, including without limitation the rights 52 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 53 | copies of the Software, and to permit persons to whom the Software is furnished 54 | to do so, subject to the following conditions: 55 | 56 | The above copyright notice and this permission notice shall be included in all 57 | copies or substantial portions of the Software. 58 | 59 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 60 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 61 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 62 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 63 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 64 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 65 | THE SOFTWARE. 66 | 67 | 68 | Title 69 | SDWebImage 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Generated by CocoaPods - https://cocoapods.org 76 | Title 77 | 78 | Type 79 | PSGroupSpecifier 80 | 81 | 82 | StringsTable 83 | Acknowledgements 84 | Title 85 | Acknowledgements 86 | 87 | 88 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ADViewDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ADViewDemo 5 | @end 6 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | *) 22 | TARGET_DEVICE_ARGS="--target-device mac" 23 | ;; 24 | esac 25 | 26 | realpath() { 27 | DIRECTORY="$(cd "${1%/*}" && pwd)" 28 | FILENAME="${1##*/}" 29 | echo "$DIRECTORY/$FILENAME" 30 | } 31 | 32 | install_resource() 33 | { 34 | if [[ "$1" = /* ]] ; then 35 | RESOURCE_PATH="$1" 36 | else 37 | RESOURCE_PATH="${PODS_ROOT}/$1" 38 | fi 39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 40 | cat << EOM 41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 42 | EOM 43 | exit 1 44 | fi 45 | case $RESOURCE_PATH in 46 | *.storyboard) 47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 49 | ;; 50 | *.xib) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.framework) 55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 59 | ;; 60 | *.xcdatamodel) 61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 63 | ;; 64 | *.xcdatamodeld) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 67 | ;; 68 | *.xcmappingmodel) 69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 71 | ;; 72 | *.xcassets) 73 | ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") 74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 75 | ;; 76 | *) 77 | echo "$RESOURCE_PATH" 78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 79 | ;; 80 | esac 81 | } 82 | 83 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 86 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 87 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | fi 89 | rm -f "$RESOURCES_TO_COPY" 90 | 91 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 92 | then 93 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 94 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 95 | while read line; do 96 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 97 | XCASSET_FILES+=("$line") 98 | fi 99 | done <<<"$OTHER_XCASSETS" 100 | 101 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 102 | fi 103 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDCycleScrollView" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDCycleScrollView" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDCycleScrollView" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"SDCycleScrollView" -l"SDWebImage" -framework "ImageIO" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/Pods-ADViewDemo/Pods-ADViewDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDCycleScrollView" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDCycleScrollView" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDCycleScrollView" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"SDCycleScrollView" -l"SDWebImage" -framework "ImageIO" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/SDCycleScrollView/SDCycleScrollView-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDCycleScrollView : NSObject 3 | @end 4 | @implementation PodsDummy_SDCycleScrollView 5 | @end 6 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/SDCycleScrollView/SDCycleScrollView-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/SDCycleScrollView/SDCycleScrollView.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDCycleScrollView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDCycleScrollView" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDCycleScrollView" "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /ADViewDemo/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDCycleScrollView" "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = -framework "ImageIO" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /DesktopADView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "DesktopADView" 3 | s.version = "2.3.3" 4 | s.summary = "仿滴滴/Uber 的启动之后再控制器上面弹出多个广告,带删除按钮的动画绘制" 5 | s.homepage = "https://github.com/tpctt/DesktopADView" 6 | s.social_media_url = "https://github.com/tpctt/DesktopADView" 7 | s.platform = :ios,'6.0' 8 | s.license = { :type => "MIT", :file => "LICENSE" } 9 | s.author = { " tim" => "491590253@qq.com" } 10 | s.source = { :git => "https://github.com/tpctt/DesktopADView.git",:tag => s.version.to_s } 11 | s.ios.deployment_target = "6.0" 12 | s.requires_arc = true 13 | s.framework = "CoreFoundation","Foundation","CoreGraphics","Security","UIKit" 14 | s.library = "z.1.1.3","stdc++","sqlite3" 15 | s.source_files = 'DesktopADView/**/*.{h,m,mm}' 16 | #s.resources = 'SIDADView/*.{bundle}' 17 | 18 | 19 | # s.subspec 'YMCitySelect' do |sp| 20 | # sp.source_files = 'YMCitySelect/*.{h,m,mm}' 21 | # sp.resources = "Extend/**/*.{png}" 22 | # sp.requires_arc = true 23 | # sp.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libz, $(SDKROOT)/usr/include/libxml2', 'CLANG_CXX_LANGUAGE_STANDARD' => 'gnu++0x', 'CLANG_CXX_LIBRARY' => 'libstdc++', 'CLANG_WARN_DIRECT_OBJC_ISA_USAGE' => 'YES'} 24 | 25 | # sp.dependency 'FontIcon' 26 | # sp.prefix_header_contents = '#import "EasyIOS.h"' 27 | # end 28 | end 29 | -------------------------------------------------------------------------------- /DesktopADView/DesktopADView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SIDADView.h 3 | // SIDAdView 4 | // 5 | // Created by XU JUNJIE on 13/7/15. 6 | // Copyright (c) 2015 ISNC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | ///查看产品详情来源 13 | typedef NS_ENUM(NSUInteger, DesktopADViewDelLocType ){ 14 | DesktopADViewDelLocType_TopRight = 0, 15 | DesktopADViewDelLocType_BottomCenter , 16 | 17 | 18 | }; 19 | 20 | IB_DESIGNABLE 21 | @interface DesktopADView : UIView 22 | 23 | ///广告的锚点的anchorPointOffset 24 | @property (assign,nonatomic) IBInspectable CGPoint anchorPointOffset; 25 | ///广告的宽度比例,=0 表示不约束,直接使用adview 的宽度 26 | @property (assign,nonatomic) IBInspectable CGFloat widthToSuperView; 27 | ///广告的高宽比 ,=0 表示不约束,直接使用adview 的高度 28 | @property (assign,nonatomic) IBInspectable CGFloat adRatio; 29 | ///删除按钮的大小 30 | @property (assign,nonatomic) IBInspectable CGFloat delIconWidth; 31 | ///删除按钮对应 ad 的距离 32 | @property (assign,nonatomic) IBInspectable CGFloat delIconDelt; 33 | ///关闭按钮的颜色 34 | @property ( strong,nonatomic) IBInspectable UIColor *closeBtnColor; 35 | ///广告,single or more 36 | @property ( strong,nonatomic) UIView *adView; 37 | ///mask 38 | @property ( strong,nonatomic) UIView *maskView; 39 | ///非自定义 adview 的点击动作 block,返回值表示是否从 superview 移除 40 | @property ( copy,nonatomic) BOOL (^tapAdviewBlock)( bool tapAdview ,NSInteger index) ; 41 | @property ( copy,nonatomic) BOOL (^tapCloseBlock)( bool tapAdview ,NSInteger index) ; 42 | 43 | ///是否显示删除按钮 44 | @property ( assign,nonatomic) IBInspectable BOOL showDelBtn; 45 | @property ( assign,nonatomic) IBInspectable DesktopADViewDelLocType showDelLocType; 46 | 47 | 48 | ///显示的 view,image 作为 ad 为默认的 imageview 时使用,其他自定义的adview 按照对应的设置 49 | - (void)showInView:(UIView *)view image: (UIImage *)image; 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 iOSDeveloper赵依民 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DesktopADView 2 | 3 | ![image](https://camo.githubusercontent.com/3dc8a44a2c3f7ccd5418008d1295aae48466c141/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43617274686167652d636f6d70617469626c652d3442433531442e7376673f7374796c653d666c6174) 4 | ============== 5 | 仿滴滴/Uber 的启动之后再控制器上面弹出多个广告,带删除按钮的动画绘制.广告显示部分 是解耦合的,可以完全自定义 6 | 显示的广告的大小 可以安装原始的比例显示 或者设置比例 7 | 8 | some fork from SID-AD-View-iOS and modify projects 9 | An advertisement View for developers that cooperated with SuperID. 10 | 11 | ![image](img/AD_Img.png) 12 | ![image](img/AD_Img2.png) 13 | 14 | ``` 15 | pod 'DesktopADView' 16 | 17 | ## Usage 18 | There is a demo project included that shows how to use the SID-AD-View. 19 | 20 | - draw the file "DesktopADView.h","DesktopADView.m" into your project./ pod 'DesktopADView' from https://github.com/timRabbit/DesktopADView 21 | - import `DesktopADView.h` in your class 22 | - create a new instance of `DesktopADView` 23 | - using the following API to show the view: 24 | - 支持横竖屏切换 25 | - 关闭按钮动画实现,颜色大小,间距自定义, 删除的 x 不会超出圆圈的位置 26 | 27 | ``` 28 | ///默认 UIIMAGEVIEW 做为 adview, 29 | - (void)showInView:(UIView *)view image: (UIImage *)image; 30 | 31 | ///自定义 view 做 adview,我拓展为 SDCycleScrollView,实现支付宝 芝麻信用那里的那个效果 32 | DesktopADView *adView = [[DesktopADView alloc]init]; 33 | ///自定义的 adview, 我拓展为 SDCycleScrollView 34 | adView.adView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageNamesGroup:@[@"adImage" , @"adImage" ]]; 35 | 36 | [adView showInView:self.view image:[UIImage imageNamed:@"adImage"]]; 37 | 38 | ``` 39 | ##Give Feedback 40 | 41 | **Contact:** 491590253@qq.com 42 | 43 | 44 | ///TODO 45 | 1. 自定义 xx 的位置和方向 46 | 2. 支持 xx 的图片显示 47 | 3. 优化 ad 的宽高比例的使用方法 48 | 49 | -------------------------------------------------------------------------------- /img/AD_Img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpctt/DesktopADView/396947f20e0fcb4b79b9e2b466d96e12d6e7fdf6/img/AD_Img.png -------------------------------------------------------------------------------- /img/AD_Img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpctt/DesktopADView/396947f20e0fcb4b79b9e2b466d96e12d6e7fdf6/img/AD_Img2.png --------------------------------------------------------------------------------