├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CarouselDemo ├── CarouselDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── PSCarouselViewTests.xcscheme ├── CarouselDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── CarouselDemo │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── CarouselInCollectionView │ │ ├── DemoCollectionViewCell.h │ │ ├── DemoCollectionViewCell.m │ │ ├── DemoCollectionViewController.h │ │ └── DemoCollectionViewController.m │ ├── CarouselInTableView │ │ ├── CarouselCell.h │ │ ├── CarouselCell.m │ │ ├── DemoTableViewController.h │ │ └── DemoTableViewController.m │ ├── CarouselInView │ │ ├── ViewController.h │ │ └── ViewController.m │ ├── CarouselWithSwift │ │ └── SwiftViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── placeholder.imageset │ │ │ ├── Contents.json │ │ │ ├── home_banner_jiazai.png │ │ │ ├── home_banner_jiazai@2x.png │ │ │ └── home_banner_jiazai@3x.png │ ├── Resource │ │ └── Macros.h │ └── SupportingFile │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Info.plist │ │ └── main.m ├── PSCarouselView │ ├── PSCarouselCollectionCell.h │ ├── PSCarouselCollectionCell.m │ ├── PSCarouselCollectionCell.xib │ ├── PSCarouselView.h │ ├── PSCarouselView.m │ ├── PSWeaker.h │ └── PSWeaker.m ├── PSCarouselViewTests │ ├── Info.plist │ └── PSCarouselViewTests.m ├── Podfile ├── Podfile.lock ├── Pods │ ├── Local Podspecs │ │ └── PSCarouselView.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ ├── SDWebImage │ │ ├── LICENSE │ │ ├── README.md │ │ └── SDWebImage │ │ │ ├── NSButton+WebCache.h │ │ │ ├── NSButton+WebCache.m │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── NSData+ImageContentType.m │ │ │ ├── NSImage+WebCache.h │ │ │ ├── NSImage+WebCache.m │ │ │ ├── SDAnimatedImageRep.h │ │ │ ├── SDAnimatedImageRep.m │ │ │ ├── SDImageCache.h │ │ │ ├── SDImageCache.m │ │ │ ├── SDImageCacheConfig.h │ │ │ ├── SDImageCacheConfig.m │ │ │ ├── SDWebImageCoder.h │ │ │ ├── SDWebImageCoder.m │ │ │ ├── SDWebImageCoderHelper.h │ │ │ ├── SDWebImageCoderHelper.m │ │ │ ├── SDWebImageCodersManager.h │ │ │ ├── SDWebImageCodersManager.m │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageCompat.m │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImageDownloader.m │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImageDownloaderOperation.m │ │ │ ├── SDWebImageFrame.h │ │ │ ├── SDWebImageFrame.m │ │ │ ├── SDWebImageGIFCoder.h │ │ │ ├── SDWebImageGIFCoder.m │ │ │ ├── SDWebImageImageIOCoder.h │ │ │ ├── SDWebImageImageIOCoder.m │ │ │ ├── SDWebImageManager.h │ │ │ ├── SDWebImageManager.m │ │ │ ├── SDWebImageOperation.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── SDWebImagePrefetcher.m │ │ │ ├── SDWebImageTransition.h │ │ │ ├── SDWebImageTransition.m │ │ │ ├── UIButton+WebCache.h │ │ │ ├── UIButton+WebCache.m │ │ │ ├── UIImage+ForceDecode.h │ │ │ ├── UIImage+ForceDecode.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+WebCache.h │ │ │ ├── UIView+WebCache.m │ │ │ ├── UIView+WebCacheOperation.h │ │ │ └── UIView+WebCacheOperation.m │ └── Target Support Files │ │ ├── PSCarouselView │ │ ├── Info.plist │ │ ├── PSCarouselView-dummy.m │ │ ├── PSCarouselView-prefix.pch │ │ ├── PSCarouselView-umbrella.h │ │ ├── PSCarouselView.modulemap │ │ ├── PSCarouselView.xcconfig │ │ └── ResourceBundle-PSCarouselView-Info.plist │ │ ├── Pods-CarouselDemo │ │ ├── Info.plist │ │ ├── Pods-CarouselDemo-acknowledgements.markdown │ │ ├── Pods-CarouselDemo-acknowledgements.plist │ │ ├── Pods-CarouselDemo-dummy.m │ │ ├── Pods-CarouselDemo-frameworks.sh │ │ ├── Pods-CarouselDemo-resources.sh │ │ ├── Pods-CarouselDemo-umbrella.h │ │ ├── Pods-CarouselDemo.debug.xcconfig │ │ ├── Pods-CarouselDemo.modulemap │ │ └── Pods-CarouselDemo.release.xcconfig │ │ └── SDWebImage │ │ ├── Info.plist │ │ ├── SDWebImage-dummy.m │ │ ├── SDWebImage-prefix.pch │ │ ├── SDWebImage-umbrella.h │ │ ├── SDWebImage.modulemap │ │ └── SDWebImage.xcconfig ├── doc │ └── html │ │ ├── Classes │ │ ├── PSCarouselCollectionCell.html │ │ ├── PSCarouselView.html │ │ └── PSWeaker.html │ │ ├── Protocols │ │ └── PSCarouselDelegate.html │ │ ├── css │ │ ├── scss │ │ │ ├── _index.scss │ │ │ ├── _layout.scss │ │ │ ├── _normalize.scss │ │ │ ├── _object.scss │ │ │ ├── _print.scss │ │ │ ├── _variables.scss │ │ │ ├── _xcode.scss │ │ │ └── style.scss │ │ └── style.css │ │ ├── hierarchy.html │ │ ├── img │ │ ├── button_bar_background.png │ │ ├── disclosure.png │ │ ├── disclosure_open.png │ │ ├── library_background.png │ │ └── title_background.png │ │ ├── index.html │ │ └── js │ │ └── script.js └── fastlane │ ├── .env │ ├── Appfile │ └── Fastfile ├── Inspector.png ├── LICENSE ├── PSCarouselView.gif ├── PSCarouselView.podspec ├── README.md ├── README_CN.md ├── customclass.png ├── logo.png └── logo.sketch /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode8 -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | #### v1.6.1 4 | 5 | **ENHANCEMENT** 6 | 7 | - 打包成动态库,适配 Swift 和 Objective-C 8 | 9 | #### v1.5.1 10 | 11 | **ENHANCEMENT** 12 | 13 | - 新加接口,可以选择滚动方向 14 | 15 | **BUG FIX** 16 | 17 | - Prevent #13 18 | 19 | #### V 1.4.0 20 | 21 | **ENHANCEMENT** 22 | 23 | - 当只有一张图片的时候,不轮播也无法滚动。 24 | 25 | `-startMoving` 接口没变,但是行为发生了一些变化。从这个版本开始,调用此接口,如果图片数量少于 2 张,或者 isAutoMoving 属性为 NO 的时候,不会起任何作用。 26 | 27 | **BUG FIX** 28 | 29 | - Fix #11 30 | 31 | #### V 1.3.2 32 | 33 | Fix #10 34 | 35 | #### V 1.3.1 36 | 37 | Fix BUG 38 | 39 | #### V 1.3.0 40 | 41 | Fix #9. 42 | 43 | #### V 1.3.0 44 | 45 | add `PSWeaker` to resolve retain circle. 46 | 47 | #### V 1.2.2 48 | 49 | Pure code usage supported. 50 | 51 | #### V 1.2.1 52 | 53 | ``` 54 | fix bug 55 | ``` 56 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo.xcodeproj/xcshareddata/xcschemes/PSCarouselViewTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInCollectionView/DemoCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @header DemoCollectionViewCell.h 4 | 5 | @abstract DemoCollectionViewCell 6 | 7 | @author Created by Pan on 16/2/2. 8 | 9 | @version 1.0.5 16/2/2 Creation 10 | 11 | Copyright © 2016年 Pan. All rights reserved. 12 | 13 | */ 14 | 15 | #import 16 | 17 | /*! 18 | 19 | @class DemoCollectionViewCell 20 | 21 | @abstract DemoCollectionViewCell 22 | 23 | */ 24 | @interface DemoCollectionViewCell : UICollectionViewCell 25 | 26 | @property (nonatomic, strong) NSArray *imageURLs; 27 | @property (nonatomic, assign) NSTimeInterval speed; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInCollectionView/DemoCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoCollectionViewCell.m 3 | // 4 | // Created by Pan on 16/2/2. 5 | // Copyright © 2016年 Pan. All rights reserved. 6 | // 7 | 8 | #import "DemoCollectionViewCell.h" 9 | #import 10 | #import "Macros.h" 11 | 12 | @interface DemoCollectionViewCell () 13 | 14 | @property (weak, nonatomic) IBOutlet PSCarouselView *carouselView; 15 | 16 | @end 17 | 18 | @implementation DemoCollectionViewCell 19 | 20 | - (void)awakeFromNib 21 | { 22 | [super awakeFromNib]; 23 | self.carouselView.placeholder = PLACEHOLDER_IMAGE; 24 | self.carouselView.autoMoving = YES; 25 | self.carouselView.movingTimeInterval = 1.5f; 26 | } 27 | 28 | - (void)layoutSubviews 29 | { 30 | [super layoutSubviews]; 31 | self.carouselView.movingTimeInterval = self.speed; 32 | } 33 | 34 | - (void)prepareForReuse 35 | { 36 | [super prepareForReuse]; 37 | self.imageURLs = nil; 38 | } 39 | 40 | - (void)setImageURLs:(NSArray *)imageURLs 41 | { 42 | _imageURLs = imageURLs; 43 | self.carouselView.imageURLs = imageURLs; 44 | [self.carouselView startMoving]; 45 | } 46 | 47 | - (void)setSpeed:(NSTimeInterval)speed 48 | { 49 | _speed = speed; 50 | self.carouselView.movingTimeInterval = speed; 51 | NSInteger integer = (int)(speed + 0.5); 52 | self.carouselView.scrollDirection = integer % 2; 53 | } 54 | @end 55 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInCollectionView/DemoCollectionViewController.h: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @header DemoCollectionViewController.h 4 | 5 | @abstract DemoCollectionViewController 6 | 7 | @author Created by Pan on 16/2/2. 8 | 9 | @version 1.0.5 16/2/2 Creation 10 | 11 | Copyright © 2016年 Pan. All rights reserved. 12 | 13 | */ 14 | 15 | #import 16 | 17 | /*! 18 | 19 | @class DemoCollectionViewController 20 | 21 | @abstract DemoCollectionViewController 22 | 23 | */ 24 | @interface DemoCollectionViewController : UICollectionViewController 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInCollectionView/DemoCollectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoCollectionViewController.m 3 | // 4 | // Created by Pan on 16/2/2. 5 | // Copyright © 2016年 Pan. All rights reserved. 6 | // 7 | 8 | #import "DemoCollectionViewController.h" 9 | #import "DemoCollectionViewCell.h" 10 | #import "Macros.h" 11 | 12 | @interface DemoCollectionViewController () 13 | 14 | 15 | @end 16 | 17 | @implementation DemoCollectionViewController 18 | 19 | #pragma mark - Public 20 | 21 | #pragma mark - Life cycle 22 | - (void)viewDidLoad 23 | { 24 | [super viewDidLoad]; 25 | 26 | } 27 | 28 | #pragma mark - IBAction 29 | 30 | 31 | #pragma mark - Navigation 32 | 33 | 34 | #pragma mark - UIColelctionViewDelegate 35 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 36 | { 37 | return 30; 38 | } 39 | 40 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 41 | { 42 | DemoCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[DemoCollectionViewCell description] forIndexPath:indexPath]; 43 | cell.imageURLs = IMAGE_URLS; 44 | cell.speed = indexPath.item % 4 + 1; 45 | return cell; 46 | } 47 | 48 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 49 | { 50 | CGFloat length = CGRectGetWidth(self.view.bounds) / 3; 51 | return CGSizeMake(length,length); 52 | } 53 | #pragma mark - Notification 54 | 55 | 56 | #pragma mark - Private Method 57 | 58 | 59 | #pragma mark - Getter and Setter 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInTableView/CarouselCell.h: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @header CarouselCell.h 4 | 5 | @abstract 6 | 7 | @author Created by Pan on 16/1/31. 8 | 9 | @version 16/1/31 Creation 10 | 11 | Copyright © 2016年 Pan. All rights reserved. 12 | 13 | */ 14 | 15 | #import 16 | 17 | /*! 18 | 19 | @class CarouselCell 20 | 21 | @abstract 22 | 23 | */ 24 | @interface CarouselCell : UITableViewCell 25 | 26 | @property (nonatomic, strong) NSArray *imageURLs; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInTableView/CarouselCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarouselCell.m 3 | // 4 | // Created by Pan on 16/1/31. 5 | // Copyright © 2016年 Pan. All rights reserved. 6 | // 7 | 8 | #import "CarouselCell.h" 9 | #import 10 | #import "Macros.h" 11 | 12 | @interface CarouselCell () 13 | 14 | @property (weak, nonatomic) IBOutlet PSCarouselView *carouselView; 15 | 16 | 17 | @end 18 | 19 | @implementation CarouselCell 20 | 21 | - (void)awakeFromNib 22 | { 23 | [super awakeFromNib]; 24 | self.carouselView.placeholder = PLACEHOLDER_IMAGE; 25 | self.carouselView.autoMoving = YES; 26 | self.carouselView.movingTimeInterval = 1.5f; 27 | } 28 | 29 | - (void)setImageURLs:(NSArray *)imageURLs 30 | { 31 | _imageURLs = imageURLs; 32 | self.carouselView.imageURLs = imageURLs; 33 | [self.carouselView startMoving]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInTableView/DemoTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoTableViewController.h 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 16/1/21. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DemoTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInTableView/DemoTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoTableViewController.m 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 16/1/21. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | #import "DemoTableViewController.h" 10 | #import "CarouselCell.h" 11 | #import "Macros.h" 12 | 13 | #define CAROUSEL_SECTION 0 14 | #define NORMARL_SECTION 1 15 | 16 | @interface DemoTableViewController () 17 | 18 | @property (nonatomic, strong) NSMutableArray *dataSource; 19 | 20 | @end 21 | 22 | @implementation DemoTableViewController 23 | 24 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 25 | { 26 | return 2; 27 | } 28 | 29 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 30 | { 31 | return section == CAROUSEL_SECTION ? 1 : self.dataSource.count; 32 | } 33 | 34 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 35 | { 36 | if (indexPath.section == CAROUSEL_SECTION) 37 | { 38 | CarouselCell *cell = [tableView dequeueReusableCellWithIdentifier:[CarouselCell description] 39 | forIndexPath:indexPath]; 40 | cell.imageURLs = IMAGE_URLS; 41 | return cell; 42 | } 43 | else if (indexPath.section == NORMARL_SECTION) 44 | { 45 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[UITableViewCell description] 46 | forIndexPath:indexPath]; 47 | cell.textLabel.text = [self.dataSource objectAtIndex:indexPath.row]; 48 | return cell; 49 | } 50 | return nil; 51 | } 52 | 53 | #pragma mark - Getter && Setter 54 | - (NSMutableArray *)dataSource 55 | { 56 | if (!_dataSource) 57 | { 58 | _dataSource = [NSMutableArray array]; 59 | for (NSInteger i = 0; i < 20; i++) 60 | { 61 | [_dataSource addObject:@(i).stringValue]; 62 | } 63 | } 64 | return _dataSource; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 15/8/13. 6 | // Copyright (c) 2015年 Pan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface ViewController : UIViewController 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselInView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 15/8/13. 6 | // Copyright (c) 2015年 Pan. All rights reserved. 7 | // 8 | 9 | 10 | 11 | #import "ViewController.h" 12 | #import 13 | #import "Macros.h" 14 | 15 | @interface ViewController () 16 | 17 | @property (weak, nonatomic) IBOutlet PSCarouselView *carouselView; 18 | @property (weak, nonatomic) IBOutlet UIPageControl *pageControl; 19 | @property (weak, nonatomic) IBOutlet UILabel *speedLabel; 20 | 21 | - (IBAction)didDragSpeedSlider:(UISlider *)sender; 22 | 23 | @end 24 | 25 | @implementation ViewController 26 | 27 | #pragma mark - Life Cycle 28 | 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | [self setupCarouselView]; 33 | [self setupPageControl]; 34 | } 35 | 36 | - (void)viewWillAppear:(BOOL)animated 37 | { 38 | [super viewWillAppear:animated]; 39 | [self.carouselView startMoving]; 40 | } 41 | 42 | - (void)viewWillDisappear:(BOOL)animated 43 | { 44 | [super viewWillDisappear:animated]; 45 | [self.carouselView stopMoving]; 46 | } 47 | 48 | #pragma mark - Private Method 49 | 50 | - (void)setupCarouselView 51 | { 52 | self.carouselView.imageURLs = [self imageURLs]; 53 | self.carouselView.placeholder = PLACEHOLDER_IMAGE; 54 | self.carouselView.pageDelegate = self; 55 | self.carouselView.autoMoving = YES; 56 | self.carouselView.movingTimeInterval = 1.5f; 57 | } 58 | 59 | - (void)setupPageControl 60 | { 61 | self.pageControl.numberOfPages = [[self imageURLs] count]; 62 | } 63 | 64 | - (NSArray *)imageURLs 65 | { 66 | return @[[NSURL URLWithString:IMAGE_URLSTRING0], 67 | [NSURL URLWithString:IMAGE_URLSTRING1], 68 | [NSURL URLWithString:IMAGE_URLSTRING2]]; 69 | } 70 | 71 | #pragma mark - PSCarouselDelegate 72 | 73 | - (void)carousel:(PSCarouselView *)carousel didMoveToPage:(NSUInteger)page 74 | { 75 | NSLog(@"PSCarouselView MOVE to No.%ld page",page); 76 | self.pageControl.currentPage = page; 77 | } 78 | 79 | - (void)carousel:(PSCarouselView *)carousel didTouchPage:(NSUInteger)page 80 | { 81 | NSLog(@"PSCarouselView did TOUCH No.%ld page",page); 82 | } 83 | 84 | - (void)carousel:(PSCarouselView *)carousel 85 | didDownloadImages:(UIImage *)image 86 | atPage:(NSUInteger)page 87 | { 88 | NSLog(@"PSCarouselView did DOWNLOAD No.%ld page",page); 89 | } 90 | 91 | - (IBAction)didDragSpeedSlider:(UISlider *)sender 92 | { 93 | self.speedLabel.text = [NSString stringWithFormat:@"滚动速度:%.1lf秒/次",sender.value]; 94 | self.carouselView.movingTimeInterval = sender.value; 95 | [self.carouselView stopMoving]; 96 | [self.carouselView startMoving]; 97 | } 98 | @end 99 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/CarouselWithSwift/SwiftViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftViewController.swift 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 16/4/18. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PSCarouselView 11 | 12 | let IMAGE_URLSTRING0 = "http://img.hb.aicdn.com/0f14ad30f6c0b4e4cf96afcad7a0f9d6332e5b061b5f3c-uSUEUC_fw658" 13 | let IMAGE_URLSTRING1 = "http://img.hb.aicdn.com/3f9d1434ba618579d50ae8c8476087f1a04d7ee3169f8e-zD2u09_fw658" 14 | let IMAGE_URLSTRING2 = "http://img.hb.aicdn.com/81427fb53bed38bf1b6a0c5da1c5d5a485e00bd1149232-gn4CO1_fw658" 15 | 16 | let ScreenWidth = UIScreen.main.bounds.size.width 17 | 18 | class SwiftViewController: UIViewController { 19 | var carouselView: PSCarouselView = PSCarouselView() 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | automaticallyAdjustsScrollViewInsets = false 24 | setupCarouselView() 25 | view.addSubview(carouselView) 26 | } 27 | 28 | override func viewWillAppear(_ animated: Bool) { 29 | super.viewWillAppear(animated) 30 | carouselView.startMoving() 31 | } 32 | 33 | func setupCarouselView() { 34 | carouselView.frame = CGRect(x: 0,y: 64,width: ScreenWidth,height: 0.382 * ScreenWidth) 35 | carouselView.imageURLs = [IMAGE_URLSTRING0,IMAGE_URLSTRING1,IMAGE_URLSTRING2] 36 | carouselView.placeholder = UIImage(named: "placeholder") 37 | carouselView.isAutoMoving = true 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "home_banner_jiazai.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "home_banner_jiazai@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "home_banner_jiazai@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/home_banner_jiazai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/home_banner_jiazai.png -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/home_banner_jiazai@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/home_banner_jiazai@2x.png -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/home_banner_jiazai@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/CarouselDemo/Images.xcassets/placeholder.imageset/home_banner_jiazai@3x.png -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/Resource/Macros.h: -------------------------------------------------------------------------------- 1 | // 2 | // Macros.h 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 16/1/31. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | #ifndef Macros_h 10 | #define Macros_h 11 | 12 | static NSString *const IMAGE_URLSTRING0 = @"http://img.hb.aicdn.com/0f14ad30f6c0b4e4cf96afcad7a0f9d6332e5b061b5f3c-uSUEUC_fw658"; 13 | static NSString *const IMAGE_URLSTRING1 = @"http://img.hb.aicdn.com/3f9d1434ba618579d50ae8c8476087f1a04d7ee3169f8e-zD2u09_fw658"; 14 | static NSString *const IMAGE_URLSTRING2 = @"http://img.hb.aicdn.com/81427fb53bed38bf1b6a0c5da1c5d5a485e00bd1149232-gn4CO1_fw658"; 15 | 16 | #define PLACEHOLDER_IMAGE [UIImage imageNamed:@"placeholder"] 17 | 18 | #define IMAGE_URLS @[[NSURL URLWithString:IMAGE_URLSTRING0],[NSURL URLWithString:IMAGE_URLSTRING1],[NSURL URLWithString:IMAGE_URLSTRING2]] 19 | #endif /* Macros_h */ 20 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/SupportingFile/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 15/8/13. 6 | // Copyright (c) 2015年 Pan. 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 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/SupportingFile/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 15/8/13. 6 | // Copyright (c) 2015年 Pan. 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 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/SupportingFile/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | 轮播 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UIRequiredDeviceCapabilities 37 | 38 | armv7 39 | 40 | UISupportedInterfaceOrientations 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | UIInterfaceOrientationPortraitUpsideDown 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo/SupportingFile/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 15/8/13. 6 | // Copyright (c) 2015年 Pan. 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 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselView/PSCarouselCollectionCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarouselCollectionCell.h 3 | // 4 | // Created by Pan on 15/7/20. 5 | // Copyright (c) 2015年 Pan. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | /** 11 | * 轮播控件采用的Cell 12 | */ 13 | @interface PSCarouselCollectionCell : UICollectionViewCell 14 | 15 | /** 16 | * 显示轮播图的Cell 17 | */ 18 | @property (strong, nonatomic) IBOutlet UIImageView *adImageView; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselView/PSCarouselCollectionCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarouselCollectionCell.m 3 | // 4 | // Created by Pan on 15/7/20. 5 | // Copyright (c) 2015年 Pan. All rights reserved. 6 | // 7 | 8 | #import "PSCarouselCollectionCell.h" 9 | 10 | @implementation PSCarouselCollectionCell 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselView/PSCarouselCollectionCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselView/PSCarouselView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarouselView.h 3 | // 4 | // Created by Pan on 15/7/20. 5 | // Copyright (c) 2015年 Pan. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class PSCarouselView; 11 | 12 | typedef NS_ENUM(NSInteger, PSCarouselViewScrollDirection) { 13 | PSCarouselViewScrollDirectionRightToLeft = 0, 14 | PSCarouselViewScrollDirectionLeftToRight 15 | }; 16 | 17 | /** 18 | * PSCarouselView的代理方法 19 | */ 20 | @protocol PSCarouselDelegate 21 | @optional 22 | 23 | /// @warning SDWebImage库是必备的。使用本控件请确保导入了SDWebImage 24 | /// @warning SDWebImage is required. Make sure that you had import SDWebImage when use this widget; 25 | 26 | /** 27 | * 告诉代理滚动到哪一页了 28 | * 29 | * @param carousel 触发此代理方法的PSCarouselView 30 | * @param page 目前滚动到那一页了,相当于`imageURL`的index。 31 | */ 32 | - (void)carousel:(nonnull PSCarouselView *)carousel didMoveToPage:(NSUInteger)page; 33 | 34 | /** 35 | * 告诉代理用户点击了某一页 36 | * 37 | * @param carousel 触发此代理方法的PSCarouselView 38 | * @param page 用户点击的页码,相当于`imageURL`的index。 39 | */ 40 | - (void)carousel:(nonnull PSCarouselView *)carousel didTouchPage:(NSUInteger)page; 41 | 42 | /** 43 | * 告诉代理,下载好了哪一张图片 44 | * 45 | * @param carousel 触发此代理方法的PSCarouselView 46 | * @param image 下载好的图片 47 | * @param page 标明该图片是哪一页的图片,相当于`imageURL`的index。 48 | */ 49 | - (void)carousel:(nonnull PSCarouselView *)carousel didDownloadImages:(nonnull UIImage *)image atPage:(NSUInteger)page; 50 | @end 51 | 52 | /** 53 | * 一个简单易用的广告轮播控件 54 | * @see 设计思路请查看[这里]:http://shengpan.net/pscarouselview/ 55 | */ 56 | @interface PSCarouselView : UICollectionView 57 | 58 | /** 59 | * 需要被轮播的图片URL数组。只需要给这个这个属性赋值,就会自动获取图片。刷新数据请再次给此属性赋值。 60 | */ 61 | @property (nullable, nonatomic, strong) NSArray *imageURLs; 62 | 63 | /** 64 | * 没有轮播图时的占位图 65 | */ 66 | @property (nullable, nonatomic, strong) IBInspectable UIImage *placeholder; 67 | 68 | 69 | #pragma mark - Configuration 70 | 71 | /** 72 | * 是否自动轮播,默认为NO 73 | */ 74 | @property (nonatomic,getter=isAutoMoving) IBInspectable BOOL autoMoving; 75 | 76 | /** 77 | * 滚动速率 默认为3.0 即3秒翻页一次 78 | */ 79 | @property (nonatomic) IBInspectable CGFloat movingTimeInterval; 80 | 81 | /** 82 | 系统在追踪用户手势时是否继续轮播。例如:scrollView 滑动时。设为 YES 会有潜在的性能影响。默认为 NO。 83 | */ 84 | @property (nonatomic, assign, getter=isMovingOnTraking) IBInspectable BOOL movingOnTracking; 85 | 86 | /** 87 | * 图片显示的缩放模式,默认为ScaleAspectFill 88 | */ 89 | @property (nonatomic) UIViewContentMode imageViewMode; 90 | 91 | /** 92 | * PSCarouselView的代理 93 | */ 94 | @property (nullable, nonatomic, weak) id pageDelegate; 95 | 96 | /** 97 | * 自动滚动时的滚动方向。默认是 PSCarouselViewScrollDirectionRightToLeft。 98 | */ 99 | @property (nonatomic, assign) PSCarouselViewScrollDirection scrollDirection; 100 | 101 | /** 102 | * 初始化并返回一个指定Frame的PSCarouselView 103 | * 104 | * @param frame 在SuperView中的Frame 105 | * 106 | * @return PSCarouselView的实例 107 | */ 108 | - (nonnull instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; 109 | 110 | /** 111 | * 从Storyboard/Xib中读取时会走这个方法,直接调用无效。 112 | * 113 | * @param aDecoder 一个解压对象 114 | * 115 | * @return PSCarouselView的实例 116 | */ 117 | - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; 118 | 119 | /** 120 | * 开始轮播。 121 | * 当图片数量 < 2 张 或者 isAutoMoving == NO 的时候,调用此 API 不会产生任何效果。 122 | */ 123 | - (void)startMoving; 124 | 125 | /** 126 | * 停止轮播 127 | */ 128 | - (void)stopMoving; 129 | @end 130 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselView/PSWeaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSWeaker.h 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 16/6/1. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | /** 13 | * 本类用于解决某些系统类造成的循环引用问题,比如说NSTimer。 14 | */ 15 | @interface PSWeaker : NSObject 16 | 17 | /** 18 | * 初始化一个weaker,并弱引用被传入的对象 19 | * @param object 需要被弱引用的对象 20 | * @return 一个弱引用了指定对象的Weaker。 21 | */ 22 | - (instancetype)initWithObject:(id)object NS_DESIGNATED_INITIALIZER; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselView/PSWeaker.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSWeaker.m 3 | // CarouselDemo 4 | // 5 | // Created by Pan on 16/6/1. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | #import "PSWeaker.h" 10 | 11 | @interface PSWeaker () 12 | 13 | @property (nonatomic, weak) id target; 14 | 15 | 16 | @end 17 | 18 | @implementation PSWeaker 19 | 20 | - (instancetype)initWithObject:(id)object 21 | { 22 | self = [super init]; 23 | if (self) 24 | { 25 | _target = object; 26 | } 27 | return self; 28 | } 29 | 30 | - (instancetype)init 31 | { 32 | return [self initWithObject:nil]; 33 | } 34 | 35 | - (id)forwardingTargetForSelector:(SEL)aSelector 36 | { 37 | return self.target; 38 | } 39 | 40 | - (void)forwardInvocation:(NSInvocation *)invocation 41 | { 42 | void *nullPointer = NULL; 43 | [invocation setReturnValue:&nullPointer]; 44 | } 45 | 46 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector 47 | { 48 | return [NSObject instanceMethodSignatureForSelector:@selector(init)]; 49 | } 50 | @end 51 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselViewTests/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 | -------------------------------------------------------------------------------- /CarouselDemo/PSCarouselViewTests/PSCarouselViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSCarouselViewTests.m 3 | // PSCarouselViewTests 4 | // 5 | // Created by Pan on 16/6/3. 6 | // Copyright © 2016年 Pan. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "Macros.h" 12 | 13 | @interface PSCarouselViewTests : XCTestCase 14 | 15 | @property (nonatomic, strong) PSCarouselView *carouselView; 16 | @property (nonatomic, strong) XCTestExpectation *testingExpectation; 17 | 18 | @property (nonatomic, strong) NSMutableArray *passByIndexArray; 19 | 20 | 21 | @end 22 | 23 | @implementation PSCarouselViewTests 24 | 25 | - (void)setUp 26 | { 27 | [super setUp]; 28 | [self setupCarouselView]; 29 | self.passByIndexArray = [NSMutableArray array]; 30 | } 31 | 32 | - (void)tearDown 33 | { 34 | [super tearDown]; 35 | self.passByIndexArray = nil; 36 | self.testingExpectation = nil; 37 | } 38 | 39 | - (void)testThatCarouselViewPageMoveSequence 40 | { 41 | XCTestExpectation *expectation = [self expectationWithDescription:@"Page Move Step Pass"]; 42 | self.testingExpectation = expectation; 43 | [self.carouselView startMoving]; 44 | [self waitForExpectationsWithTimeout:10 handler:nil]; 45 | } 46 | 47 | 48 | - (void)setupCarouselView 49 | { 50 | self.carouselView = [[PSCarouselView alloc] initWithFrame:[UIScreen mainScreen].bounds]; 51 | self.carouselView.imageURLs = [self imageURLs]; 52 | self.carouselView.placeholder = PLACEHOLDER_IMAGE; 53 | self.carouselView.pageDelegate = self; 54 | self.carouselView.autoMoving = YES; 55 | self.carouselView.movingTimeInterval = 0.5f; 56 | } 57 | 58 | - (NSArray *)imageURLs 59 | { 60 | return @[[NSURL URLWithString:IMAGE_URLSTRING0], 61 | [NSURL URLWithString:IMAGE_URLSTRING1], 62 | [NSURL URLWithString:IMAGE_URLSTRING2]]; 63 | } 64 | 65 | 66 | #pragma mark - PSCarouselDelegate 67 | - (void)carousel:(nonnull PSCarouselView *)carousel didMoveToPage:(NSUInteger)page 68 | { 69 | [self.passByIndexArray addObject:@(page)]; 70 | // 让轮播走两个循环,看看顺序是不是对的。 71 | NSInteger imageCount = [self imageURLs].count; 72 | if (self.passByIndexArray.count < imageCount * 2) 73 | { 74 | return; 75 | } 76 | 77 | NSMutableArray *expectationArray = [NSMutableArray array]; 78 | for (NSInteger i = 0; i < imageCount; i++) 79 | { 80 | [expectationArray addObject:@(i)]; 81 | } 82 | [expectationArray addObjectsFromArray:expectationArray]; 83 | 84 | if ([expectationArray isEqualToArray:self.passByIndexArray]) 85 | { 86 | [self.testingExpectation fulfill]; 87 | } 88 | else 89 | { 90 | XCTFail(@"Page Move sequence error!"); 91 | } 92 | } 93 | 94 | - (void)carousel:(nonnull PSCarouselView *)carousel didTouchPage:(NSUInteger)page 95 | { 96 | 97 | } 98 | 99 | - (void)carousel:(nonnull PSCarouselView *)carousel didDownloadImages:(nonnull UIImage *)image atPage:(NSUInteger)page 100 | { 101 | 102 | } 103 | 104 | 105 | 106 | //- (void)testPerformanceExample { 107 | // // This is an example of a performance test case. 108 | // [self measureBlock:^{ 109 | // // Put the code you want to measure the time of here. 110 | // }]; 111 | //} 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /CarouselDemo/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '8.0' 3 | # Uncomment this line if you're using Swift 4 | # use_frameworks! 5 | 6 | target 'CarouselDemo' do 7 | use_frameworks! 8 | pod 'PSCarouselView', :path => '../' 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /CarouselDemo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PSCarouselView (1.6.1): 3 | - SDWebImage 4 | - SDWebImage (4.3.3): 5 | - SDWebImage/Core (= 4.3.3) 6 | - SDWebImage/Core (4.3.3) 7 | 8 | DEPENDENCIES: 9 | - PSCarouselView (from `../`) 10 | 11 | SPEC REPOS: 12 | https://github.com/CocoaPods/Specs.git: 13 | - SDWebImage 14 | 15 | EXTERNAL SOURCES: 16 | PSCarouselView: 17 | :path: "../" 18 | 19 | SPEC CHECKSUMS: 20 | PSCarouselView: 424f04d4709a55416da8d58db70ef163fe7b2bf0 21 | SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5 22 | 23 | PODFILE CHECKSUM: 90de61718878dd7dc6c25c5dff31dac4f953a3ba 24 | 25 | COCOAPODS: 1.5.0 26 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Local Podspecs/PSCarouselView.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PSCarouselView", 3 | "version": "1.6.1", 4 | "summary": "A drop-in carousel view. Most of Apps put it in their first screen.", 5 | "description": "A drop-in carousel view. Most of Apps put it in their first screen.Ease use and quick compose.", 6 | "homepage": "http://shengpan.net/pscarouselview/", 7 | "screenshots": "https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/PSCarouselView.gif", 8 | "license": "MIT", 9 | "authors": { 10 | "Pan": "developerpans@163.com" 11 | }, 12 | "social_media_url": "http://shengpan.net", 13 | "platforms": { 14 | "ios": "7.0" 15 | }, 16 | "requires_arc": true, 17 | "source": { 18 | "git": "https://github.com/DeveloperPans/PSCarouselView.git", 19 | "tag": "1.6.1" 20 | }, 21 | "source_files": "CarouselDemo/PSCarouselView/**/*.{h,m}", 22 | "resource_bundles": { 23 | "PSCarouselView": "CarouselDemo/PSCarouselView/*.xib" 24 | }, 25 | "frameworks": "UIKit", 26 | "dependencies": { 27 | "SDWebImage": [ 28 | 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PSCarouselView (1.6.1): 3 | - SDWebImage 4 | - SDWebImage (4.3.3): 5 | - SDWebImage/Core (= 4.3.3) 6 | - SDWebImage/Core (4.3.3) 7 | 8 | DEPENDENCIES: 9 | - PSCarouselView (from `../`) 10 | 11 | SPEC REPOS: 12 | https://github.com/CocoaPods/Specs.git: 13 | - SDWebImage 14 | 15 | EXTERNAL SOURCES: 16 | PSCarouselView: 17 | :path: "../" 18 | 19 | SPEC CHECKSUMS: 20 | PSCarouselView: 424f04d4709a55416da8d58db70ef163fe7b2bf0 21 | SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5 22 | 23 | PODFILE CHECKSUM: 90de61718878dd7dc6c25c5dff31dac4f953a3ba 24 | 25 | COCOAPODS: 1.5.0 26 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/NSButton+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 "NSButton+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | static inline NSString * imageOperationKey() { 18 | return @"NSButtonImageOperation"; 19 | } 20 | 21 | static inline NSString * alternateImageOperationKey() { 22 | return @"NSButtonAlternateImageOperation"; 23 | } 24 | 25 | @implementation NSButton (WebCache) 26 | 27 | #pragma mark - Image 28 | 29 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 30 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 31 | } 32 | 33 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 34 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 35 | } 36 | 37 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 38 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 39 | } 40 | 41 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 42 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 43 | } 44 | 45 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 46 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 47 | } 48 | 49 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 50 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 51 | } 52 | 53 | - (void)sd_setImageWithURL:(nullable NSURL *)url 54 | placeholderImage:(nullable UIImage *)placeholder 55 | options:(SDWebImageOptions)options 56 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 57 | completed:(nullable SDExternalCompletionBlock)completedBlock { 58 | self.sd_currentImageURL = url; 59 | 60 | __weak typeof(self)weakSelf = self; 61 | [self sd_internalSetImageWithURL:url 62 | placeholderImage:placeholder 63 | options:options 64 | operationKey:imageOperationKey() 65 | setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData) { 66 | weakSelf.image = image; 67 | } 68 | progress:progressBlock 69 | completed:completedBlock]; 70 | } 71 | 72 | #pragma mark - Alternate Image 73 | 74 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url { 75 | [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 76 | } 77 | 78 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 79 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 80 | } 81 | 82 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 83 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 84 | } 85 | 86 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 87 | [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 88 | } 89 | 90 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 91 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 92 | } 93 | 94 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 95 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 96 | } 97 | 98 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url 99 | placeholderImage:(nullable UIImage *)placeholder 100 | options:(SDWebImageOptions)options 101 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 102 | completed:(nullable SDExternalCompletionBlock)completedBlock { 103 | self.sd_currentAlternateImageURL = url; 104 | 105 | __weak typeof(self)weakSelf = self; 106 | [self sd_internalSetImageWithURL:url 107 | placeholderImage:placeholder 108 | options:options 109 | operationKey:alternateImageOperationKey() 110 | setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData) { 111 | weakSelf.alternateImage = image; 112 | } 113 | progress:progressBlock 114 | completed:completedBlock]; 115 | } 116 | 117 | #pragma mark - Cancel 118 | 119 | - (void)sd_cancelCurrentImageLoad { 120 | [self sd_cancelImageLoadOperationWithKey:imageOperationKey()]; 121 | } 122 | 123 | - (void)sd_cancelCurrentAlternateImageLoad { 124 | [self sd_cancelImageLoadOperationWithKey:alternateImageOperationKey()]; 125 | } 126 | 127 | #pragma mar - Private 128 | 129 | - (NSURL *)sd_currentImageURL { 130 | return objc_getAssociatedObject(self, @selector(sd_currentImageURL)); 131 | } 132 | 133 | - (void)setSd_currentImageURL:(NSURL *)sd_currentImageURL { 134 | objc_setAssociatedObject(self, @selector(sd_currentImageURL), sd_currentImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 135 | } 136 | 137 | - (NSURL *)sd_currentAlternateImageURL { 138 | return objc_getAssociatedObject(self, @selector(sd_currentAlternateImageURL)); 139 | } 140 | 141 | - (void)setSd_currentAlternateImageURL:(NSURL *)sd_currentAlternateImageURL { 142 | objc_setAssociatedObject(self, @selector(sd_currentAlternateImageURL), sd_currentAlternateImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 143 | } 144 | 145 | @end 146 | 147 | #endif 148 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | typedef NS_ENUM(NSInteger, SDImageFormat) { 14 | SDImageFormatUndefined = -1, 15 | SDImageFormatJPEG = 0, 16 | SDImageFormatPNG, 17 | SDImageFormatGIF, 18 | SDImageFormatTIFF, 19 | SDImageFormatWebP, 20 | SDImageFormatHEIC 21 | }; 22 | 23 | @interface NSData (ImageContentType) 24 | 25 | /** 26 | * Return image format 27 | * 28 | * @param data the input image data 29 | * 30 | * @return the image format as `SDImageFormat` (enum) 31 | */ 32 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 33 | 34 | /** 35 | Convert SDImageFormat to UTType 36 | 37 | @param format Format as SDImageFormat 38 | @return The UTType as CFStringRef 39 | */ 40 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "NSData+ImageContentType.h" 11 | #if SD_MAC 12 | #import 13 | #else 14 | #import 15 | #endif 16 | 17 | // Currently Image/IO does not support WebP 18 | #define kSDUTTypeWebP ((__bridge CFStringRef)@"public.webp") 19 | // AVFileTypeHEIC is defined in AVFoundation via iOS 11, we use this without import AVFoundation 20 | #define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic") 21 | 22 | @implementation NSData (ImageContentType) 23 | 24 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { 25 | if (!data) { 26 | return SDImageFormatUndefined; 27 | } 28 | 29 | // File signatures table: http://www.garykessler.net/library/file_sigs.html 30 | uint8_t c; 31 | [data getBytes:&c length:1]; 32 | switch (c) { 33 | case 0xFF: 34 | return SDImageFormatJPEG; 35 | case 0x89: 36 | return SDImageFormatPNG; 37 | case 0x47: 38 | return SDImageFormatGIF; 39 | case 0x49: 40 | case 0x4D: 41 | return SDImageFormatTIFF; 42 | case 0x52: { 43 | if (data.length >= 12) { 44 | //RIFF....WEBP 45 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 46 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 47 | return SDImageFormatWebP; 48 | } 49 | } 50 | break; 51 | } 52 | case 0x00: { 53 | if (data.length >= 12) { 54 | //....ftypheic ....ftypheix ....ftyphevc ....ftyphevx 55 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(4, 8)] encoding:NSASCIIStringEncoding]; 56 | if ([testString isEqualToString:@"ftypheic"] 57 | || [testString isEqualToString:@"ftypheix"] 58 | || [testString isEqualToString:@"ftyphevc"] 59 | || [testString isEqualToString:@"ftyphevx"]) { 60 | return SDImageFormatHEIC; 61 | } 62 | } 63 | break; 64 | } 65 | } 66 | return SDImageFormatUndefined; 67 | } 68 | 69 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format { 70 | CFStringRef UTType; 71 | switch (format) { 72 | case SDImageFormatJPEG: 73 | UTType = kUTTypeJPEG; 74 | break; 75 | case SDImageFormatPNG: 76 | UTType = kUTTypePNG; 77 | break; 78 | case SDImageFormatGIF: 79 | UTType = kUTTypeGIF; 80 | break; 81 | case SDImageFormatTIFF: 82 | UTType = kUTTypeTIFF; 83 | break; 84 | case SDImageFormatWebP: 85 | UTType = kSDUTTypeWebP; 86 | break; 87 | case SDImageFormatHEIC: 88 | UTType = kSDUTTypeHEIC; 89 | break; 90 | default: 91 | // default is kUTTypePNG 92 | UTType = kUTTypePNG; 93 | break; 94 | } 95 | return UTType; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | @interface NSImage (WebCache) 16 | 17 | - (CGImageRef)CGImage; 18 | - (NSArray *)images; 19 | - (BOOL)isGIF; 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSImage+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSImage (WebCache) 14 | 15 | - (CGImageRef)CGImage { 16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; 18 | return cgImage; 19 | } 20 | 21 | - (NSArray *)images { 22 | return nil; 23 | } 24 | 25 | - (BOOL)isGIF { 26 | BOOL isGIF = NO; 27 | for (NSImageRep *rep in self.representations) { 28 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 29 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep; 30 | NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; 31 | isGIF = frameCount > 1 ? YES : NO; 32 | break; 33 | } 34 | } 35 | return isGIF; 36 | } 37 | 38 | @end 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | // A subclass of `NSBitmapImageRep` to fix that GIF loop count issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`. 14 | // Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDWebImageImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image. 15 | 16 | @interface SDAnimatedImageRep : NSBitmapImageRep 17 | 18 | @end 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.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 "SDAnimatedImageRep.h" 10 | 11 | #if SD_MAC 12 | 13 | #import "SDWebImageGIFCoder.h" 14 | 15 | @interface SDWebImageGIFCoder () 16 | 17 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source; 18 | 19 | @end 20 | 21 | @interface SDAnimatedImageRep () 22 | 23 | @property (nonatomic, assign, readonly, nullable) CGImageSourceRef imageSource; 24 | 25 | @end 26 | 27 | @implementation SDAnimatedImageRep 28 | 29 | // `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need. 30 | - (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value { 31 | [super setProperty:property withValue:value]; 32 | if ([property isEqualToString:NSImageCurrentFrame]) { 33 | // Access the image source 34 | CGImageSourceRef imageSource = self.imageSource; 35 | if (!imageSource) { 36 | return; 37 | } 38 | // Check format type 39 | CFStringRef type = CGImageSourceGetType(imageSource); 40 | if (!type) { 41 | return; 42 | } 43 | NSUInteger index = [value unsignedIntegerValue]; 44 | float frameDuration = 0; 45 | // Through we currently process GIF only, in the 5.x we support APNG so we keep the extensibility 46 | if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) { 47 | frameDuration = [[SDWebImageGIFCoder sharedCoder] sd_frameDurationAtIndex:index source:imageSource]; 48 | } 49 | if (!frameDuration) { 50 | return; 51 | } 52 | // Reset super frame duration with the actual frame duration 53 | [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)]; 54 | } 55 | } 56 | 57 | - (CGImageSourceRef)imageSource { 58 | if (_tiffData) { 59 | return (__bridge CGImageSourceRef)(_tiffData); 60 | } 61 | return NULL; 62 | } 63 | 64 | @end 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface SDImageCacheConfig : NSObject 13 | 14 | /** 15 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 16 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 17 | */ 18 | @property (assign, nonatomic) BOOL shouldDecompressImages; 19 | 20 | /** 21 | * disable iCloud backup [defaults to YES] 22 | */ 23 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 24 | 25 | /** 26 | * use memory cache [defaults to YES] 27 | */ 28 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 29 | 30 | /** 31 | * The reading options while reading cache from disk. 32 | * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance. 33 | */ 34 | @property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions; 35 | 36 | /** 37 | * The writing options while writing cache to disk. 38 | * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file. 39 | */ 40 | @property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions; 41 | 42 | /** 43 | * The maximum length of time to keep an image in the cache, in seconds. 44 | */ 45 | @property (assign, nonatomic) NSInteger maxCacheAge; 46 | 47 | /** 48 | * The maximum size of the cache, in bytes. 49 | */ 50 | @property (assign, nonatomic) NSUInteger maxCacheSize; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCacheConfig.h" 10 | 11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week 12 | 13 | @implementation SDImageCacheConfig 14 | 15 | - (instancetype)init { 16 | if (self = [super init]) { 17 | _shouldDecompressImages = YES; 18 | _shouldDisableiCloud = YES; 19 | _shouldCacheImagesInMemory = YES; 20 | _diskCacheReadingOptions = 0; 21 | _diskCacheWritingOptions = NSDataWritingAtomic; 22 | _maxCacheAge = kDefaultCacheMaxCacheAge; 23 | _maxCacheSize = 0; 24 | } 25 | return self; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCoder.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 "NSData+ImageContentType.h" 12 | 13 | /** 14 | A Boolean value indicating whether to scale down large images during decompressing. (NSNumber) 15 | */ 16 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageCoderScaleDownLargeImagesKey; 17 | 18 | /** 19 | Return the shared device-dependent RGB color space created with CGColorSpaceCreateDeviceRGB. 20 | 21 | @return The device-dependent RGB color space 22 | */ 23 | CG_EXTERN CGColorSpaceRef _Nonnull SDCGColorSpaceGetDeviceRGB(void); 24 | 25 | /** 26 | Check whether CGImageRef contains alpha channel. 27 | 28 | @param imageRef The CGImageRef 29 | @return Return YES if CGImageRef contains alpha channel, otherwise return NO 30 | */ 31 | CG_EXTERN BOOL SDCGImageRefContainsAlpha(_Nullable CGImageRef imageRef); 32 | 33 | 34 | /** 35 | This is the image coder protocol to provide custom image decoding/encoding. 36 | These methods are all required to implement. 37 | @note Pay attention that these methods are not called from main queue. 38 | */ 39 | @protocol SDWebImageCoder 40 | 41 | @required 42 | #pragma mark - Decoding 43 | /** 44 | Returns YES if this coder can decode some data. Otherwise, the data should be passed to another coder. 45 | 46 | @param data The image data so we can look at it 47 | @return YES if this coder can decode the data, NO otherwise 48 | */ 49 | - (BOOL)canDecodeFromData:(nullable NSData *)data; 50 | 51 | /** 52 | Decode the image data to image. 53 | 54 | @param data The image data to be decoded 55 | @return The decoded image from data 56 | */ 57 | - (nullable UIImage *)decodedImageWithData:(nullable NSData *)data; 58 | 59 | /** 60 | Decompress the image with original image and image data. 61 | 62 | @param image The original image to be decompressed 63 | @param data The pointer to original image data. The pointer itself is nonnull but image data can be null. This data will set to cache if needed. If you do not need to modify data at the sametime, ignore this param. 64 | @param optionsDict A dictionary containing any decompressing options. Pass {SDWebImageCoderScaleDownLargeImagesKey: @(YES)} to scale down large images 65 | @return The decompressed image 66 | */ 67 | - (nullable UIImage *)decompressedImageWithImage:(nullable UIImage *)image 68 | data:(NSData * _Nullable * _Nonnull)data 69 | options:(nullable NSDictionary*)optionsDict; 70 | 71 | #pragma mark - Encoding 72 | 73 | /** 74 | Returns YES if this coder can encode some image. Otherwise, it should be passed to another coder. 75 | 76 | @param format The image format 77 | @return YES if this coder can encode the image, NO otherwise 78 | */ 79 | - (BOOL)canEncodeToFormat:(SDImageFormat)format; 80 | 81 | /** 82 | Encode the image to image data. 83 | 84 | @param image The image to be encoded 85 | @param format The image format to encode, you should note `SDImageFormatUndefined` format is also possible 86 | @return The encoded image data 87 | */ 88 | - (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image format:(SDImageFormat)format; 89 | 90 | @end 91 | 92 | 93 | /** 94 | This is the image coder protocol to provide custom progressive image decoding. 95 | These methods are all required to implement. 96 | @note Pay attention that these methods are not called from main queue. 97 | */ 98 | @protocol SDWebImageProgressiveCoder 99 | 100 | @required 101 | /** 102 | Returns YES if this coder can incremental decode some data. Otherwise, it should be passed to another coder. 103 | 104 | @param data The image data so we can look at it 105 | @return YES if this coder can decode the data, NO otherwise 106 | */ 107 | - (BOOL)canIncrementallyDecodeFromData:(nullable NSData *)data; 108 | 109 | /** 110 | Incremental decode the image data to image. 111 | 112 | @param data The image data has been downloaded so far 113 | @param finished Whether the download has finished 114 | @warning because incremental decoding need to keep the decoded context, we will alloc a new instance with the same class for each download operation to avoid conflicts 115 | @return The decoded image from data 116 | */ 117 | - (nullable UIImage *)incrementallyDecodedImageWithData:(nullable NSData *)data finished:(BOOL)finished; 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCoder.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 "SDWebImageCoder.h" 10 | 11 | NSString * const SDWebImageCoderScaleDownLargeImagesKey = @"scaleDownLargeImages"; 12 | 13 | CGColorSpaceRef SDCGColorSpaceGetDeviceRGB(void) { 14 | static CGColorSpaceRef colorSpace; 15 | static dispatch_once_t onceToken; 16 | dispatch_once(&onceToken, ^{ 17 | colorSpace = CGColorSpaceCreateDeviceRGB(); 18 | }); 19 | return colorSpace; 20 | } 21 | 22 | BOOL SDCGImageRefContainsAlpha(CGImageRef imageRef) { 23 | if (!imageRef) { 24 | return NO; 25 | } 26 | CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef); 27 | BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || 28 | alphaInfo == kCGImageAlphaNoneSkipFirst || 29 | alphaInfo == kCGImageAlphaNoneSkipLast); 30 | return hasAlpha; 31 | } 32 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCoderHelper.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 "SDWebImageFrame.h" 12 | 13 | @interface SDWebImageCoderHelper : NSObject 14 | 15 | /** 16 | Return an animated image with frames array. 17 | For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work. 18 | For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not) 19 | 20 | @param frames The frames array. If no frames or frames is empty, return nil 21 | @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit) 22 | */ 23 | + (UIImage * _Nullable)animatedImageWithFrames:(NSArray * _Nullable)frames; 24 | 25 | /** 26 | Return frames array from an animated image. 27 | For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage. 28 | For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array. 29 | 30 | @param animatedImage A animated image. If it's not animated, return nil 31 | @return The frames array 32 | */ 33 | + (NSArray * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage; 34 | 35 | #if SD_UIKIT || SD_WATCH 36 | /** 37 | Convert an EXIF image orientation to an iOS one. 38 | 39 | @param exifOrientation EXIF orientation 40 | @return iOS orientation 41 | */ 42 | + (UIImageOrientation)imageOrientationFromEXIFOrientation:(NSInteger)exifOrientation; 43 | /** 44 | Convert an iOS orientation to an EXIF image orientation. 45 | 46 | @param imageOrientation iOS orientation 47 | @return EXIF orientation 48 | */ 49 | + (NSInteger)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation; 50 | #endif 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCodersManager.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 "SDWebImageCoder.h" 11 | 12 | /** 13 | Global object holding the array of coders, so that we avoid passing them from object to object. 14 | Uses a priority queue behind scenes, which means the latest added coders have the highest priority. 15 | This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data. 16 | That way, users can add their custom coders while preserving our existing prebuilt ones 17 | 18 | Note: the `coders` getter will return the coders in their reversed order 19 | Example: 20 | - by default we internally set coders = `IOCoder`, `WebPCoder`. (`GIFCoder` is not recommended to add only if you want to get GIF support without `FLAnimatedImage`) 21 | - calling `coders` will return `@[WebPCoder, IOCoder]` 22 | - call `[addCoder:[MyCrazyCoder new]]` 23 | - calling `coders` now returns `@[MyCrazyCoder, WebPCoder, IOCoder]` 24 | 25 | Coders 26 | ------ 27 | A coder must conform to the `SDWebImageCoder` protocol or even to `SDWebImageProgressiveCoder` if it supports progressive decoding 28 | Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat` 29 | Those methods are called on each coder in the array (using the priority order) until one of them returns YES. 30 | That means that coder can decode that data / encode to that format 31 | */ 32 | @interface SDWebImageCodersManager : NSObject 33 | 34 | /** 35 | Shared reusable instance 36 | */ 37 | + (nonnull instancetype)sharedInstance; 38 | 39 | /** 40 | All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority 41 | */ 42 | @property (nonatomic, strong, readwrite, nullable) NSArray* coders; 43 | 44 | /** 45 | Add a new coder to the end of coders array. Which has the highest priority. 46 | 47 | @param coder coder 48 | */ 49 | - (void)addCoder:(nonnull id)coder; 50 | 51 | /** 52 | Remove a coder in the coders array. 53 | 54 | @param coder coder 55 | */ 56 | - (void)removeCoder:(nonnull id)coder; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCodersManager.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 "SDWebImageCodersManager.h" 10 | #import "SDWebImageImageIOCoder.h" 11 | #import "SDWebImageGIFCoder.h" 12 | #ifdef SD_WEBP 13 | #import "SDWebImageWebPCoder.h" 14 | #endif 15 | 16 | @interface SDWebImageCodersManager () 17 | 18 | @property (strong, nonatomic, nonnull) NSMutableArray* mutableCoders; 19 | @property (strong, nonatomic, nullable) dispatch_queue_t mutableCodersAccessQueue; 20 | 21 | @end 22 | 23 | @implementation SDWebImageCodersManager 24 | 25 | + (nonnull instancetype)sharedInstance { 26 | static dispatch_once_t once; 27 | static id instance; 28 | dispatch_once(&once, ^{ 29 | instance = [self new]; 30 | }); 31 | return instance; 32 | } 33 | 34 | - (instancetype)init { 35 | if (self = [super init]) { 36 | // initialize with default coders 37 | _mutableCoders = [@[[SDWebImageImageIOCoder sharedCoder]] mutableCopy]; 38 | #ifdef SD_WEBP 39 | [_mutableCoders addObject:[SDWebImageWebPCoder sharedCoder]]; 40 | #endif 41 | _mutableCodersAccessQueue = dispatch_queue_create("com.hackemist.SDWebImageCodersManager", DISPATCH_QUEUE_CONCURRENT); 42 | } 43 | return self; 44 | } 45 | 46 | #pragma mark - Coder IO operations 47 | 48 | - (void)addCoder:(nonnull id)coder { 49 | if ([coder conformsToProtocol:@protocol(SDWebImageCoder)]) { 50 | dispatch_barrier_sync(self.mutableCodersAccessQueue, ^{ 51 | [self.mutableCoders addObject:coder]; 52 | }); 53 | } 54 | } 55 | 56 | - (void)removeCoder:(nonnull id)coder { 57 | dispatch_barrier_sync(self.mutableCodersAccessQueue, ^{ 58 | [self.mutableCoders removeObject:coder]; 59 | }); 60 | } 61 | 62 | - (NSArray *)coders { 63 | __block NSArray *sortedCoders = nil; 64 | dispatch_sync(self.mutableCodersAccessQueue, ^{ 65 | sortedCoders = (NSArray *)[[[self.mutableCoders copy] reverseObjectEnumerator] allObjects]; 66 | }); 67 | return sortedCoders; 68 | } 69 | 70 | - (void)setCoders:(NSArray *)coders { 71 | dispatch_barrier_sync(self.mutableCodersAccessQueue, ^{ 72 | self.mutableCoders = [coders mutableCopy]; 73 | }); 74 | } 75 | 76 | #pragma mark - SDWebImageCoder 77 | - (BOOL)canDecodeFromData:(NSData *)data { 78 | for (id coder in self.coders) { 79 | if ([coder canDecodeFromData:data]) { 80 | return YES; 81 | } 82 | } 83 | return NO; 84 | } 85 | 86 | - (BOOL)canEncodeToFormat:(SDImageFormat)format { 87 | for (id coder in self.coders) { 88 | if ([coder canEncodeToFormat:format]) { 89 | return YES; 90 | } 91 | } 92 | return NO; 93 | } 94 | 95 | - (UIImage *)decodedImageWithData:(NSData *)data { 96 | if (!data) { 97 | return nil; 98 | } 99 | for (id coder in self.coders) { 100 | if ([coder canDecodeFromData:data]) { 101 | return [coder decodedImageWithData:data]; 102 | } 103 | } 104 | return nil; 105 | } 106 | 107 | - (UIImage *)decompressedImageWithImage:(UIImage *)image 108 | data:(NSData *__autoreleasing _Nullable *)data 109 | options:(nullable NSDictionary*)optionsDict { 110 | if (!image) { 111 | return nil; 112 | } 113 | for (id coder in self.coders) { 114 | if ([coder canDecodeFromData:*data]) { 115 | return [coder decompressedImageWithImage:image data:data options:optionsDict]; 116 | } 117 | } 118 | return nil; 119 | } 120 | 121 | - (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format { 122 | if (!image) { 123 | return nil; 124 | } 125 | for (id coder in self.coders) { 126 | if ([coder canEncodeToFormat:format]) { 127 | return [coder encodedDataWithImage:image format:format]; 128 | } 129 | } 130 | return nil; 131 | } 132 | 133 | @end 134 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | // Apple's defines from TargetConditionals.h are a bit weird. 17 | // Seems like TARGET_OS_MAC is always defined (on all platforms). 18 | // To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms 19 | #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH 20 | #define SD_MAC 1 21 | #else 22 | #define SD_MAC 0 23 | #endif 24 | 25 | // iOS and tvOS are very similar, UIKit exists on both platforms 26 | // Note: watchOS also has UIKit, but it's very limited 27 | #if TARGET_OS_IOS || TARGET_OS_TV 28 | #define SD_UIKIT 1 29 | #else 30 | #define SD_UIKIT 0 31 | #endif 32 | 33 | #if TARGET_OS_IOS 34 | #define SD_IOS 1 35 | #else 36 | #define SD_IOS 0 37 | #endif 38 | 39 | #if TARGET_OS_TV 40 | #define SD_TV 1 41 | #else 42 | #define SD_TV 0 43 | #endif 44 | 45 | #if TARGET_OS_WATCH 46 | #define SD_WATCH 1 47 | #else 48 | #define SD_WATCH 0 49 | #endif 50 | 51 | 52 | #if SD_MAC 53 | #import 54 | #ifndef UIImage 55 | #define UIImage NSImage 56 | #endif 57 | #ifndef UIImageView 58 | #define UIImageView NSImageView 59 | #endif 60 | #ifndef UIView 61 | #define UIView NSView 62 | #endif 63 | #else 64 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 65 | #error SDWebImage doesn't support Deployment Target version < 5.0 66 | #endif 67 | 68 | #if SD_UIKIT 69 | #import 70 | #endif 71 | #if SD_WATCH 72 | #import 73 | #endif 74 | #endif 75 | 76 | #ifndef NS_ENUM 77 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 78 | #endif 79 | 80 | #ifndef NS_OPTIONS 81 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 82 | #endif 83 | 84 | FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 85 | 86 | typedef void(^SDWebImageNoParamsBlock)(void); 87 | 88 | FOUNDATION_EXPORT NSString *const SDWebImageErrorDomain; 89 | 90 | #ifndef dispatch_queue_async_safe 91 | #define dispatch_queue_async_safe(queue, block)\ 92 | if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(queue)) == 0) {\ 93 | block();\ 94 | } else {\ 95 | dispatch_async(queue, block);\ 96 | } 97 | #endif 98 | 99 | #ifndef dispatch_main_async_safe 100 | #define dispatch_main_async_safe(block) dispatch_queue_async_safe(dispatch_get_main_queue(), block) 101 | #endif 102 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "UIImage+MultiFormat.h" 11 | 12 | #if !__has_feature(objc_arc) 13 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 14 | #endif 15 | 16 | #if !OS_OBJECT_USE_OBJC 17 | #error SDWebImage need ARC for dispatch object 18 | #endif 19 | 20 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { 21 | if (!image) { 22 | return nil; 23 | } 24 | 25 | #if SD_MAC 26 | return image; 27 | #elif SD_UIKIT || SD_WATCH 28 | if ((image.images).count > 0) { 29 | NSMutableArray *scaledImages = [NSMutableArray array]; 30 | 31 | for (UIImage *tempImage in image.images) { 32 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 33 | } 34 | 35 | UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 36 | if (animatedImage) { 37 | animatedImage.sd_imageLoopCount = image.sd_imageLoopCount; 38 | } 39 | return animatedImage; 40 | } else { 41 | #if SD_WATCH 42 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { 43 | #elif SD_UIKIT 44 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 45 | #endif 46 | CGFloat scale = 1; 47 | if (key.length >= 8) { 48 | NSRange range = [key rangeOfString:@"@2x."]; 49 | if (range.location != NSNotFound) { 50 | scale = 2.0; 51 | } 52 | 53 | range = [key rangeOfString:@"@3x."]; 54 | if (range.location != NSNotFound) { 55 | scale = 3.0; 56 | } 57 | } 58 | 59 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 60 | image = scaledImage; 61 | } 62 | return image; 63 | } 64 | #endif 65 | } 66 | 67 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 68 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageDownloader.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStartNotification; 14 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadReceiveResponseNotification; 15 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification; 16 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadFinishNotification; 17 | 18 | 19 | 20 | /** 21 | Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol 22 | For the description about these methods, see `SDWebImageDownloaderOperation` 23 | */ 24 | @protocol SDWebImageDownloaderOperationInterface 25 | 26 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 27 | inSession:(nullable NSURLSession *)session 28 | options:(SDWebImageDownloaderOptions)options; 29 | 30 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 31 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 32 | 33 | - (BOOL)shouldDecompressImages; 34 | - (void)setShouldDecompressImages:(BOOL)value; 35 | 36 | - (nullable NSURLCredential *)credential; 37 | - (void)setCredential:(nullable NSURLCredential *)value; 38 | 39 | - (BOOL)cancel:(nullable id)token; 40 | 41 | @end 42 | 43 | 44 | @interface SDWebImageDownloaderOperation : NSOperation 45 | 46 | /** 47 | * The request used by the operation's task. 48 | */ 49 | @property (strong, nonatomic, readonly, nullable) NSURLRequest *request; 50 | 51 | /** 52 | * The operation's task 53 | */ 54 | @property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; 55 | 56 | 57 | @property (assign, nonatomic) BOOL shouldDecompressImages; 58 | 59 | /** 60 | * Was used to determine whether the URL connection should consult the credential storage for authenticating the connection. 61 | * @deprecated Not used for a couple of versions 62 | */ 63 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility"); 64 | 65 | /** 66 | * The credential used for authentication challenges in `-URLSession:task:didReceiveChallenge:completionHandler:`. 67 | * 68 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 69 | */ 70 | @property (nonatomic, strong, nullable) NSURLCredential *credential; 71 | 72 | /** 73 | * The SDWebImageDownloaderOptions for the receiver. 74 | */ 75 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 76 | 77 | /** 78 | * The expected size of data. 79 | */ 80 | @property (assign, nonatomic) NSInteger expectedSize; 81 | 82 | /** 83 | * The response returned by the operation's task. 84 | */ 85 | @property (strong, nonatomic, nullable) NSURLResponse *response; 86 | 87 | /** 88 | * Initializes a `SDWebImageDownloaderOperation` object 89 | * 90 | * @see SDWebImageDownloaderOperation 91 | * 92 | * @param request the URL request 93 | * @param session the URL session in which this operation will run 94 | * @param options downloader options 95 | * 96 | * @return the initialized instance 97 | */ 98 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 99 | inSession:(nullable NSURLSession *)session 100 | options:(SDWebImageDownloaderOptions)options NS_DESIGNATED_INITIALIZER; 101 | 102 | /** 103 | * Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of 104 | * callbacks. 105 | * 106 | * @param progressBlock the block executed when a new chunk of data arrives. 107 | * @note the progress block is executed on a background queue 108 | * @param completedBlock the block executed when the download is done. 109 | * @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 110 | * 111 | * @return the token to use to cancel this set of handlers 112 | */ 113 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 114 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 115 | 116 | /** 117 | * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. 118 | * 119 | * @param token the token representing a set of callbacks to cancel 120 | * 121 | * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. 122 | */ 123 | - (BOOL)cancel:(nullable id)token; 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageFrame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface SDWebImageFrame : NSObject 13 | 14 | // This class is used for creating animated images via `animatedImageWithFrames` in `SDWebImageCoderHelper`. Attention if you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+MultiFormat`. 15 | 16 | /** 17 | The image of current frame. You should not set an animated image. 18 | */ 19 | @property (nonatomic, strong, readonly, nonnull) UIImage *image; 20 | /** 21 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero. 22 | */ 23 | @property (nonatomic, readonly, assign) NSTimeInterval duration; 24 | 25 | /** 26 | Create a frame instance with specify image and duration 27 | 28 | @param image current frame's image 29 | @param duration current frame's duration 30 | @return frame instance 31 | */ 32 | + (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageFrame.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 "SDWebImageFrame.h" 10 | 11 | @interface SDWebImageFrame () 12 | 13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image; 14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration; 15 | 16 | @end 17 | 18 | @implementation SDWebImageFrame 19 | 20 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration { 21 | SDWebImageFrame *frame = [[SDWebImageFrame alloc] init]; 22 | frame.image = image; 23 | frame.duration = duration; 24 | 25 | return frame; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageGIFCoder.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 "SDWebImageCoder.h" 11 | 12 | /** 13 | Built in coder using ImageIO that supports GIF encoding/decoding 14 | @note `SDWebImageIOCoder` supports GIF but only as static (will use the 1st frame). 15 | @note Use `SDWebImageGIFCoder` for fully animated GIFs - less performant than `FLAnimatedImage` 16 | @note If you decide to make all `UIImageView`(including `FLAnimatedImageView`) instance support GIF. You should add this coder to `SDWebImageCodersManager` and make sure that it has a higher priority than `SDWebImageIOCoder` 17 | @note The recommended approach for animated GIFs is using `FLAnimatedImage`. It's more performant than `UIImageView` for GIF displaying 18 | */ 19 | @interface SDWebImageGIFCoder : NSObject 20 | 21 | + (nonnull instancetype)sharedCoder; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageImageIOCoder.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 "SDWebImageCoder.h" 11 | 12 | /** 13 | Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding. 14 | 15 | GIF 16 | Also supports static GIF (meaning will only handle the 1st frame). 17 | For a full GIF support, we recommend `FLAnimatedImage` or our less performant `SDWebImageGIFCoder` 18 | 19 | HEIC 20 | This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf 21 | Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13) 22 | Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU)) 23 | Encode(Software): macOS 10.13 24 | Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU)) 25 | */ 26 | @interface SDWebImageImageIOCoder : NSObject 27 | 28 | + (nonnull instancetype)sharedCoder; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CarouselDemo/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 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched (successful or not) 24 | * @param totalCount The total number of images that were to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; 27 | 28 | /** 29 | * Called when all images are prefetched. 30 | * @param imagePrefetcher The current image prefetcher 31 | * @param totalCount The total number of images that were prefetched (whether successful or not) 32 | * @param skippedCount The total number of images that were skipped 33 | */ 34 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; 35 | 36 | @end 37 | 38 | typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); 39 | typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); 40 | 41 | /** 42 | * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. 43 | */ 44 | @interface SDWebImagePrefetcher : NSObject 45 | 46 | /** 47 | * The web image manager 48 | */ 49 | @property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; 50 | 51 | /** 52 | * Maximum number of URLs to prefetch at the same time. Defaults to 3. 53 | */ 54 | @property (nonatomic, assign) NSUInteger maxConcurrentDownloads; 55 | 56 | /** 57 | * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. 58 | */ 59 | @property (nonatomic, assign) SDWebImageOptions options; 60 | 61 | /** 62 | * Queue options for Prefetcher. Defaults to Main Queue. 63 | */ 64 | @property (strong, nonatomic, nonnull) dispatch_queue_t prefetcherQueue; 65 | 66 | @property (weak, nonatomic, nullable) id delegate; 67 | 68 | /** 69 | * Return the global image prefetcher instance. 70 | */ 71 | + (nonnull instancetype)sharedImagePrefetcher; 72 | 73 | /** 74 | * Allows you to instantiate a prefetcher with any arbitrary image manager. 75 | */ 76 | - (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; 77 | 78 | /** 79 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 80 | * currently one image is downloaded at a time, 81 | * and skips images for failed downloads and proceed to the next image in the list. 82 | * Any previously-running prefetch operations are canceled. 83 | * 84 | * @param urls list of URLs to prefetch 85 | */ 86 | - (void)prefetchURLs:(nullable NSArray *)urls; 87 | 88 | /** 89 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 90 | * currently one image is downloaded at a time, 91 | * and skips images for failed downloads and proceed to the next image in the list. 92 | * Any previously-running prefetch operations are canceled. 93 | * 94 | * @param urls list of URLs to prefetch 95 | * @param progressBlock block to be called when progress updates; 96 | * first parameter is the number of completed (successful or not) requests, 97 | * second parameter is the total number of images originally requested to be prefetched 98 | * @param completionBlock block to be called when prefetching is completed 99 | * first param is the number of completed (successful or not) requests, 100 | * second parameter is the number of skipped requests 101 | */ 102 | - (void)prefetchURLs:(nullable NSArray *)urls 103 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 104 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; 105 | 106 | /** 107 | * Remove and cancel queued list 108 | */ 109 | - (void)cancelPrefetching; 110 | 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImagePrefetcher.h" 10 | 11 | @interface SDWebImagePrefetcher () 12 | 13 | @property (strong, nonatomic, nonnull) SDWebImageManager *manager; 14 | @property (strong, atomic, nullable) NSArray *prefetchURLs; // may be accessed from different queue 15 | @property (assign, nonatomic) NSUInteger requestedCount; 16 | @property (assign, nonatomic) NSUInteger skippedCount; 17 | @property (assign, nonatomic) NSUInteger finishedCount; 18 | @property (assign, nonatomic) NSTimeInterval startedTime; 19 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; 20 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherProgressBlock progressBlock; 21 | 22 | @end 23 | 24 | @implementation SDWebImagePrefetcher 25 | 26 | + (nonnull instancetype)sharedImagePrefetcher { 27 | static dispatch_once_t once; 28 | static id instance; 29 | dispatch_once(&once, ^{ 30 | instance = [self new]; 31 | }); 32 | return instance; 33 | } 34 | 35 | - (nonnull instancetype)init { 36 | return [self initWithImageManager:[SDWebImageManager new]]; 37 | } 38 | 39 | - (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { 40 | if ((self = [super init])) { 41 | _manager = manager; 42 | _options = SDWebImageLowPriority; 43 | _prefetcherQueue = dispatch_get_main_queue(); 44 | self.maxConcurrentDownloads = 3; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { 50 | self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; 51 | } 52 | 53 | - (NSUInteger)maxConcurrentDownloads { 54 | return self.manager.imageDownloader.maxConcurrentDownloads; 55 | } 56 | 57 | - (void)startPrefetchingAtIndex:(NSUInteger)index { 58 | NSURL *currentURL; 59 | @synchronized(self) { 60 | if (index >= self.prefetchURLs.count) return; 61 | currentURL = self.prefetchURLs[index]; 62 | self.requestedCount++; 63 | } 64 | [self.manager loadImageWithURL:currentURL options:self.options progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 65 | if (!finished) return; 66 | self.finishedCount++; 67 | 68 | if (self.progressBlock) { 69 | self.progressBlock(self.finishedCount,(self.prefetchURLs).count); 70 | } 71 | if (!image) { 72 | // Add last failed 73 | self.skippedCount++; 74 | } 75 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 76 | [self.delegate imagePrefetcher:self 77 | didPrefetchURL:currentURL 78 | finishedCount:self.finishedCount 79 | totalCount:self.prefetchURLs.count 80 | ]; 81 | } 82 | if (self.prefetchURLs.count > self.requestedCount) { 83 | dispatch_async(self.prefetcherQueue, ^{ 84 | // we need dispatch to avoid function recursion call. This can prevent stack overflow even for huge urls list 85 | [self startPrefetchingAtIndex:self.requestedCount]; 86 | }); 87 | } else if (self.finishedCount == self.requestedCount) { 88 | [self reportStatus]; 89 | if (self.completionBlock) { 90 | self.completionBlock(self.finishedCount, self.skippedCount); 91 | self.completionBlock = nil; 92 | } 93 | self.progressBlock = nil; 94 | } 95 | }]; 96 | } 97 | 98 | - (void)reportStatus { 99 | NSUInteger total = (self.prefetchURLs).count; 100 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 101 | [self.delegate imagePrefetcher:self 102 | didFinishWithTotalCount:(total - self.skippedCount) 103 | skippedCount:self.skippedCount 104 | ]; 105 | } 106 | } 107 | 108 | - (void)prefetchURLs:(nullable NSArray *)urls { 109 | [self prefetchURLs:urls progress:nil completed:nil]; 110 | } 111 | 112 | - (void)prefetchURLs:(nullable NSArray *)urls 113 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 114 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { 115 | [self cancelPrefetching]; // Prevent duplicate prefetch request 116 | self.startedTime = CFAbsoluteTimeGetCurrent(); 117 | self.prefetchURLs = urls; 118 | self.completionBlock = completionBlock; 119 | self.progressBlock = progressBlock; 120 | 121 | if (urls.count == 0) { 122 | if (completionBlock) { 123 | completionBlock(0,0); 124 | } 125 | } else { 126 | // Starts prefetching from the very first image on the list with the max allowed concurrency 127 | NSUInteger listCount = self.prefetchURLs.count; 128 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 129 | [self startPrefetchingAtIndex:i]; 130 | } 131 | } 132 | } 133 | 134 | - (void)cancelPrefetching { 135 | @synchronized(self) { 136 | self.prefetchURLs = nil; 137 | self.skippedCount = 0; 138 | self.requestedCount = 0; 139 | self.finishedCount = 0; 140 | } 141 | [self.manager cancelAll]; 142 | } 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageTransition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | #import "SDImageCache.h" 13 | 14 | // This class is used to provide a transition animation after the view category load image finished. Use this on `sd_imageTransition` in UIView+WebCache.h 15 | // for UIKit(iOS & tvOS), we use `+[UIView transitionWithView:duration:options:animations:completion]` for transition animation. 16 | // for AppKit(macOS), we use `+[NSAnimationContext runAnimationGroup:completionHandler:]` for transition animation. You can call `+[NSAnimationContext currentContext]` to grab the context during animations block. 17 | // These transition are provided for basic usage. If you need complicated animation, consider to directly use Core Animation or use `SDWebImageAvoidAutoSetImage` and implement your own after image load finished. 18 | 19 | #if SD_UIKIT 20 | typedef UIViewAnimationOptions SDWebImageAnimationOptions; 21 | #else 22 | typedef NS_OPTIONS(NSUInteger, SDWebImageAnimationOptions) { 23 | SDWebImageAnimationOptionAllowsImplicitAnimation = 1 << 0, // specify `allowsImplicitAnimation` for the `NSAnimationContext` 24 | }; 25 | #endif 26 | 27 | typedef void (^SDWebImageTransitionPreparesBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL); 28 | typedef void (^SDWebImageTransitionAnimationsBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image); 29 | typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished); 30 | 31 | @interface SDWebImageTransition : NSObject 32 | 33 | /** 34 | By default, we set the image to the view at the beginning of the animtions. You can disable this and provide custom set image process 35 | */ 36 | @property (nonatomic, assign) BOOL avoidAutoSetImage; 37 | /** 38 | The duration of the transition animation, measured in seconds. Defaults to 0.5. 39 | */ 40 | @property (nonatomic, assign) NSTimeInterval duration; 41 | /** 42 | The timing function used for all animations within this transition animation (macOS). 43 | */ 44 | @property (nonatomic, strong, nullable) CAMediaTimingFunction *timingFunction NS_AVAILABLE_MAC(10_7); 45 | /** 46 | A mask of options indicating how you want to perform the animations. 47 | */ 48 | @property (nonatomic, assign) SDWebImageAnimationOptions animationOptions; 49 | /** 50 | A block object to be executed before the animation sequence starts. 51 | */ 52 | @property (nonatomic, copy, nullable) SDWebImageTransitionPreparesBlock prepares; 53 | /** 54 | A block object that contains the changes you want to make to the specified view. 55 | */ 56 | @property (nonatomic, copy, nullable) SDWebImageTransitionAnimationsBlock animations; 57 | /** 58 | A block object to be executed when the animation sequence ends. 59 | */ 60 | @property (nonatomic, copy, nullable) SDWebImageTransitionCompletionBlock completion; 61 | 62 | @end 63 | 64 | // Convenience way to create transition. Remember to specify the duration if needed. 65 | // for UIKit, these transition just use the correspond `animationOptions` 66 | // for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it. 67 | 68 | @interface SDWebImageTransition (Conveniences) 69 | 70 | // class property is available in Xcode 8. We will drop the Xcode 7.3 support in 5.x 71 | #if __has_feature(objc_class_property) 72 | /// Fade transition. 73 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition; 74 | /// Flip from left transition. 75 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition; 76 | /// Flip from right transition. 77 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromRightTransition; 78 | /// Flip from top transition. 79 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromTopTransition; 80 | /// Flip from bottom transition. 81 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromBottomTransition; 82 | /// Curl up transition. 83 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlUpTransition; 84 | /// Curl down transition. 85 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition; 86 | #else 87 | + (nonnull instancetype)fadeTransition; 88 | + (nonnull instancetype)flipFromLeftTransition; 89 | + (nonnull instancetype)flipFromRightTransition; 90 | + (nonnull instancetype)flipFromTopTransition; 91 | + (nonnull instancetype)flipFromBottomTransition; 92 | + (nonnull instancetype)curlUpTransition; 93 | + (nonnull instancetype)curlDownTransition; 94 | #endif 95 | 96 | @end 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/SDWebImageTransition.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 "SDWebImageTransition.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #if SD_MAC 14 | #import 15 | #endif 16 | 17 | @implementation SDWebImageTransition 18 | 19 | - (instancetype)init { 20 | self = [super init]; 21 | if (self) { 22 | self.duration = 0.5; 23 | } 24 | return self; 25 | } 26 | 27 | @end 28 | 29 | @implementation SDWebImageTransition (Conveniences) 30 | 31 | + (SDWebImageTransition *)fadeTransition { 32 | SDWebImageTransition *transition = [SDWebImageTransition new]; 33 | #if SD_UIKIT 34 | transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve; 35 | #else 36 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 37 | CATransition *trans = [CATransition animation]; 38 | trans.type = kCATransitionFade; 39 | [view.layer addAnimation:trans forKey:kCATransition]; 40 | }; 41 | #endif 42 | return transition; 43 | } 44 | 45 | + (SDWebImageTransition *)flipFromLeftTransition { 46 | SDWebImageTransition *transition = [SDWebImageTransition new]; 47 | #if SD_UIKIT 48 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft; 49 | #else 50 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 51 | CATransition *trans = [CATransition animation]; 52 | trans.type = kCATransitionPush; 53 | trans.subtype = kCATransitionFromLeft; 54 | [view.layer addAnimation:trans forKey:kCATransition]; 55 | }; 56 | #endif 57 | return transition; 58 | } 59 | 60 | + (SDWebImageTransition *)flipFromRightTransition { 61 | SDWebImageTransition *transition = [SDWebImageTransition new]; 62 | #if SD_UIKIT 63 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight; 64 | #else 65 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 66 | CATransition *trans = [CATransition animation]; 67 | trans.type = kCATransitionPush; 68 | trans.subtype = kCATransitionFromRight; 69 | [view.layer addAnimation:trans forKey:kCATransition]; 70 | }; 71 | #endif 72 | return transition; 73 | } 74 | 75 | + (SDWebImageTransition *)flipFromTopTransition { 76 | SDWebImageTransition *transition = [SDWebImageTransition new]; 77 | #if SD_UIKIT 78 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop; 79 | #else 80 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 81 | CATransition *trans = [CATransition animation]; 82 | trans.type = kCATransitionPush; 83 | trans.subtype = kCATransitionFromTop; 84 | [view.layer addAnimation:trans forKey:kCATransition]; 85 | }; 86 | #endif 87 | return transition; 88 | } 89 | 90 | + (SDWebImageTransition *)flipFromBottomTransition { 91 | SDWebImageTransition *transition = [SDWebImageTransition new]; 92 | #if SD_UIKIT 93 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom; 94 | #else 95 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 96 | CATransition *trans = [CATransition animation]; 97 | trans.type = kCATransitionPush; 98 | trans.subtype = kCATransitionFromBottom; 99 | [view.layer addAnimation:trans forKey:kCATransition]; 100 | }; 101 | #endif 102 | return transition; 103 | } 104 | 105 | + (SDWebImageTransition *)curlUpTransition { 106 | SDWebImageTransition *transition = [SDWebImageTransition new]; 107 | #if SD_UIKIT 108 | transition.animationOptions = UIViewAnimationOptionTransitionCurlUp; 109 | #else 110 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 111 | CATransition *trans = [CATransition animation]; 112 | trans.type = kCATransitionReveal; 113 | trans.subtype = kCATransitionFromTop; 114 | [view.layer addAnimation:trans forKey:kCATransition]; 115 | }; 116 | #endif 117 | return transition; 118 | } 119 | 120 | + (SDWebImageTransition *)curlDownTransition { 121 | SDWebImageTransition *transition = [SDWebImageTransition new]; 122 | #if SD_UIKIT 123 | transition.animationOptions = UIViewAnimationOptionTransitionCurlDown; 124 | #else 125 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 126 | CATransition *trans = [CATransition animation]; 127 | trans.type = kCATransitionReveal; 128 | trans.subtype = kCATransitionFromBottom; 129 | [view.layer addAnimation:trans forKey:kCATransition]; 130 | }; 131 | #endif 132 | return transition; 133 | } 134 | 135 | @end 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | @interface UIImage (ForceDecode) 12 | 13 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; 14 | 15 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImage+ForceDecode.h" 10 | #import "SDWebImageCodersManager.h" 11 | 12 | @implementation UIImage (ForceDecode) 13 | 14 | + (UIImage *)decodedImageWithImage:(UIImage *)image { 15 | if (!image) { 16 | return nil; 17 | } 18 | NSData *tempData; 19 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(NO)}]; 20 | } 21 | 22 | + (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image { 23 | if (!image) { 24 | return nil; 25 | } 26 | NSData *tempData; 27 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(YES)}]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface UIImage (GIF) 13 | 14 | /** 15 | * Creates an animated UIImage from an NSData. 16 | * For static GIF, will create an UIImage with `images` array set to nil. For animated GIF, will create an UIImage with valid `images` array. 17 | */ 18 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 19 | 20 | /** 21 | * Checks if an UIImage instance is a GIF. Will use the `images` array. 22 | */ 23 | - (BOOL)isGIF; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "UIImage+GIF.h" 11 | #import "SDWebImageGIFCoder.h" 12 | #import "NSImage+WebCache.h" 13 | 14 | @implementation UIImage (GIF) 15 | 16 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 17 | if (!data) { 18 | return nil; 19 | } 20 | return [[SDWebImageGIFCoder sharedCoder] decodedImageWithData:data]; 21 | } 22 | 23 | - (BOOL)isGIF { 24 | return (self.images != nil); 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "NSData+ImageContentType.h" 11 | 12 | @interface UIImage (MultiFormat) 13 | 14 | /** 15 | * UIKit: 16 | * For static image format, this value is always 0. 17 | * For animated image format, 0 means infinite looping. 18 | * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. 19 | * AppKit: 20 | * NSImage currently only support animated via GIF imageRep unlike UIImage. 21 | * The getter of this property will get the loop count from GIF imageRep 22 | * The setter of this property will set the loop count from GIF imageRep 23 | */ 24 | @property (nonatomic, assign) NSUInteger sd_imageLoopCount; 25 | 26 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 27 | - (nullable NSData *)sd_imageData; 28 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImage+MultiFormat.h" 10 | 11 | #import "objc/runtime.h" 12 | #import "SDWebImageCodersManager.h" 13 | 14 | @implementation UIImage (MultiFormat) 15 | 16 | #if SD_MAC 17 | - (NSUInteger)sd_imageLoopCount { 18 | NSUInteger imageLoopCount = 0; 19 | for (NSImageRep *rep in self.representations) { 20 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 21 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep; 22 | imageLoopCount = [[bitmapRep valueForProperty:NSImageLoopCount] unsignedIntegerValue]; 23 | break; 24 | } 25 | } 26 | return imageLoopCount; 27 | } 28 | 29 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { 30 | for (NSImageRep *rep in self.representations) { 31 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 32 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep; 33 | [bitmapRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)]; 34 | break; 35 | } 36 | } 37 | } 38 | 39 | #else 40 | 41 | - (NSUInteger)sd_imageLoopCount { 42 | NSUInteger imageLoopCount = 0; 43 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount)); 44 | if ([value isKindOfClass:[NSNumber class]]) { 45 | imageLoopCount = value.unsignedIntegerValue; 46 | } 47 | return imageLoopCount; 48 | } 49 | 50 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { 51 | NSNumber *value = @(sd_imageLoopCount); 52 | objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 53 | } 54 | #endif 55 | 56 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { 57 | return [[SDWebImageCodersManager sharedInstance] decodedImageWithData:data]; 58 | } 59 | 60 | - (nullable NSData *)sd_imageData { 61 | return [self sd_imageDataAsFormat:SDImageFormatUndefined]; 62 | } 63 | 64 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { 65 | NSData *imageData = nil; 66 | if (self) { 67 | imageData = [[SDWebImageCodersManager sharedInstance] encodedDataWithImage:self format:imageFormat]; 68 | } 69 | return imageData; 70 | } 71 | 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 17 | */ 18 | @interface UIImageView (HighlightedWebCache) 19 | 20 | /** 21 | * Set the imageView `highlightedImage` with an `url`. 22 | * 23 | * The download is asynchronous and cached. 24 | * 25 | * @param url The url for the image. 26 | */ 27 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; 28 | 29 | /** 30 | * Set the imageView `highlightedImage` with an `url` and custom options. 31 | * 32 | * The download is asynchronous and cached. 33 | * 34 | * @param url The url for the image. 35 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 36 | */ 37 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 38 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 39 | 40 | /** 41 | * Set the imageView `highlightedImage` with an `url`. 42 | * 43 | * The download is asynchronous and cached. 44 | * 45 | * @param url The url for the image. 46 | * @param completedBlock A block called when operation has been completed. This block has no return value 47 | * and takes the requested UIImage as first parameter. In case of error the image parameter 48 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 49 | * indicating if the image was retrieved from the local cache or from the network. 50 | * The fourth parameter is the original image url. 51 | */ 52 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 53 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 54 | 55 | /** 56 | * Set the imageView `highlightedImage` with an `url` and custom options. 57 | * 58 | * The download is asynchronous and cached. 59 | * 60 | * @param url The url for the image. 61 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 62 | * @param completedBlock A block called when operation has been completed. This block has no return value 63 | * and takes the requested UIImage as first parameter. In case of error the image parameter 64 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 65 | * indicating if the image was retrieved from the local cache or from the network. 66 | * The fourth parameter is the original image url. 67 | */ 68 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 69 | options:(SDWebImageOptions)options 70 | completed:(nullable SDExternalCompletionBlock)completedBlock; 71 | 72 | /** 73 | * Set the imageView `highlightedImage` with an `url` and custom options. 74 | * 75 | * The download is asynchronous and cached. 76 | * 77 | * @param url The url for the image. 78 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 79 | * @param progressBlock A block called while image is downloading 80 | * @note the progress block is executed on a background queue 81 | * @param completedBlock A block called when operation has been completed. This block has no return value 82 | * and takes the requested UIImage as first parameter. In case of error the image parameter 83 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 84 | * indicating if the image was retrieved from the local cache or from the network. 85 | * The fourth parameter is the original image url. 86 | */ 87 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 88 | options:(SDWebImageOptions)options 89 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 90 | completed:(nullable SDExternalCompletionBlock)completedBlock; 91 | 92 | @end 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+HighlightedWebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "UIView+WebCacheOperation.h" 14 | #import "UIView+WebCache.h" 15 | 16 | @implementation UIImageView (HighlightedWebCache) 17 | 18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { 19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 20 | } 21 | 22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { 23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 28 | } 29 | 30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 32 | } 33 | 34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 35 | options:(SDWebImageOptions)options 36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 37 | completed:(nullable SDExternalCompletionBlock)completedBlock { 38 | __weak typeof(self)weakSelf = self; 39 | [self sd_internalSetImageWithURL:url 40 | placeholderImage:nil 41 | options:options 42 | operationKey:@"UIImageViewImageOperationHighlighted" 43 | setImageBlock:^(UIImage *image, NSData *imageData) { 44 | weakSelf.highlightedImage = image; 45 | } 46 | progress:progressBlock 47 | completed:completedBlock]; 48 | } 49 | 50 | @end 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+WebCache.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | @implementation UIImageView (WebCache) 18 | 19 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 20 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 21 | } 22 | 23 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 24 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 25 | } 26 | 27 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 28 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 29 | } 30 | 31 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 32 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 33 | } 34 | 35 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 36 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 37 | } 38 | 39 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 40 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 41 | } 42 | 43 | - (void)sd_setImageWithURL:(nullable NSURL *)url 44 | placeholderImage:(nullable UIImage *)placeholder 45 | options:(SDWebImageOptions)options 46 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 47 | completed:(nullable SDExternalCompletionBlock)completedBlock { 48 | [self sd_internalSetImageWithURL:url 49 | placeholderImage:placeholder 50 | options:options 51 | operationKey:nil 52 | setImageBlock:nil 53 | progress:progressBlock 54 | completed:completedBlock]; 55 | } 56 | 57 | - (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url 58 | placeholderImage:(nullable UIImage *)placeholder 59 | options:(SDWebImageOptions)options 60 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 61 | completed:(nullable SDExternalCompletionBlock)completedBlock { 62 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url]; 63 | UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromCacheForKey:key]; 64 | 65 | [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock]; 66 | } 67 | 68 | #if SD_UIKIT 69 | 70 | #pragma mark - Animation of multiple images 71 | 72 | - (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs { 73 | [self sd_cancelCurrentAnimationImagesLoad]; 74 | NSPointerArray *operationsArray = [self sd_animationOperationArray]; 75 | 76 | [arrayOfURLs enumerateObjectsUsingBlock:^(NSURL *logoImageURL, NSUInteger idx, BOOL * _Nonnull stop) { 77 | __weak __typeof(self) wself = self; 78 | id operation = [[SDWebImageManager sharedManager] loadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 79 | __strong typeof(wself) sself = wself; 80 | if (!sself) return; 81 | dispatch_main_async_safe(^{ 82 | [sself stopAnimating]; 83 | if (sself && image) { 84 | NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; 85 | if (!currentImages) { 86 | currentImages = [[NSMutableArray alloc] init]; 87 | } 88 | 89 | // We know what index objects should be at when they are returned so 90 | // we will put the object at the index, filling any empty indexes 91 | // with the image that was returned too "early". These images will 92 | // be overwritten. (does not require additional sorting datastructure) 93 | while ([currentImages count] < idx) { 94 | [currentImages addObject:image]; 95 | } 96 | 97 | currentImages[idx] = image; 98 | 99 | sself.animationImages = currentImages; 100 | [sself setNeedsLayout]; 101 | } 102 | [sself startAnimating]; 103 | }); 104 | }]; 105 | @synchronized (self) { 106 | [operationsArray addPointer:(__bridge void *)(operation)]; 107 | } 108 | }]; 109 | } 110 | 111 | static char animationLoadOperationKey; 112 | 113 | // element is weak because operation instance is retained by SDWebImageManager's runningOperations property 114 | // we should use lock to keep thread-safe because these method may not be acessed from main queue 115 | - (NSPointerArray *)sd_animationOperationArray { 116 | @synchronized(self) { 117 | NSPointerArray *operationsArray = objc_getAssociatedObject(self, &animationLoadOperationKey); 118 | if (operationsArray) { 119 | return operationsArray; 120 | } 121 | operationsArray = [NSPointerArray weakObjectsPointerArray]; 122 | objc_setAssociatedObject(self, &animationLoadOperationKey, operationsArray, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 123 | return operationsArray; 124 | } 125 | } 126 | 127 | - (void)sd_cancelCurrentAnimationImagesLoad { 128 | NSPointerArray *operationsArray = [self sd_animationOperationArray]; 129 | if (operationsArray) { 130 | @synchronized (self) { 131 | for (id operation in operationsArray) { 132 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { 133 | [operation cancel]; 134 | } 135 | } 136 | operationsArray.count = 0; 137 | } 138 | } 139 | } 140 | #endif 141 | 142 | @end 143 | 144 | #endif 145 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | // These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external. 16 | // All the stored operations are weak, so it will be dalloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them. 17 | @interface UIView (WebCacheOperation) 18 | 19 | /** 20 | * Set the image load operation (storage in a UIView based weak map table) 21 | * 22 | * @param operation the operation 23 | * @param key key for storing the operation 24 | */ 25 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 26 | 27 | /** 28 | * Cancel all operations for the current UIView and key 29 | * 30 | * @param key key for identifying the operations 31 | */ 32 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 33 | 34 | /** 35 | * Just remove the operations corresponding to the current UIView and key without cancelling them 36 | * 37 | * @param key key for identifying the operations 38 | */ 39 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 40 | 41 | @end 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIView+WebCacheOperation.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | 15 | static char loadOperationKey; 16 | 17 | // key is copy, value is weak because operation instance is retained by SDWebImageManager's runningOperations property 18 | // we should use lock to keep thread-safe because these method may not be acessed from main queue 19 | typedef NSMapTable> SDOperationsDictionary; 20 | 21 | @implementation UIView (WebCacheOperation) 22 | 23 | - (SDOperationsDictionary *)sd_operationDictionary { 24 | @synchronized(self) { 25 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 26 | if (operations) { 27 | return operations; 28 | } 29 | operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0]; 30 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 31 | return operations; 32 | } 33 | } 34 | 35 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { 36 | if (key) { 37 | [self sd_cancelImageLoadOperationWithKey:key]; 38 | if (operation) { 39 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 40 | @synchronized (self) { 41 | [operationDictionary setObject:operation forKey:key]; 42 | } 43 | } 44 | } 45 | } 46 | 47 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { 48 | // Cancel in progress downloader from queue 49 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 50 | id operation; 51 | @synchronized (self) { 52 | operation = [operationDictionary objectForKey:key]; 53 | } 54 | if (operation) { 55 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]){ 56 | [operation cancel]; 57 | } 58 | @synchronized (self) { 59 | [operationDictionary removeObjectForKey:key]; 60 | } 61 | } 62 | } 63 | 64 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { 65 | if (key) { 66 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 67 | @synchronized (self) { 68 | [operationDictionary removeObjectForKey:key]; 69 | } 70 | } 71 | } 72 | 73 | @end 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.6.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/PSCarouselView-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PSCarouselView : NSObject 3 | @end 4 | @implementation PodsDummy_PSCarouselView 5 | @end 6 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/PSCarouselView-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/PSCarouselView-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "PSCarouselCollectionCell.h" 14 | #import 15 | #import "PSWeaker.h" 16 | 17 | FOUNDATION_EXPORT double PSCarouselViewVersionNumber; 18 | FOUNDATION_EXPORT const unsigned char PSCarouselViewVersionString[]; 19 | 20 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/PSCarouselView.modulemap: -------------------------------------------------------------------------------- 1 | framework module PSCarouselView { 2 | umbrella header "PSCarouselView-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/PSCarouselView.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PSCarouselView 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = -framework "UIKit" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/PSCarouselView/ResourceBundle-PSCarouselView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.6.1 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PSCarouselView 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 Sheng Pan 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 | ## SDWebImage 30 | 31 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 32 | 33 | Permission is hereby granted, free of charge, to any person obtaining a copy 34 | of this software and associated documentation files (the "Software"), to deal 35 | in the Software without restriction, including without limitation the rights 36 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 37 | copies of the Software, and to permit persons to whom the Software is furnished 38 | to do so, subject to the following conditions: 39 | 40 | The above copyright notice and this permission notice shall be included in all 41 | copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 44 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 45 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 46 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 47 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 48 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 49 | THE SOFTWARE. 50 | 51 | 52 | Generated by CocoaPods - https://cocoapods.org 53 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo-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 | MIT License 18 | 19 | Copyright (c) 2017 Sheng Pan 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 | License 40 | MIT 41 | Title 42 | PSCarouselView 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 49 | 50 | Permission is hereby granted, free of charge, to any person obtaining a copy 51 | of this software and associated documentation files (the "Software"), to deal 52 | in the Software without restriction, including without limitation the rights 53 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 54 | copies of the Software, and to permit persons to whom the Software is furnished 55 | to do so, subject to the following conditions: 56 | 57 | The above copyright notice and this permission notice shall be included in all 58 | copies or substantial portions of the Software. 59 | 60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 61 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 62 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 63 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 64 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 65 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 66 | THE SOFTWARE. 67 | 68 | 69 | License 70 | MIT 71 | Title 72 | SDWebImage 73 | Type 74 | PSGroupSpecifier 75 | 76 | 77 | FooterText 78 | Generated by CocoaPods - https://cocoapods.org 79 | Title 80 | 81 | Type 82 | PSGroupSpecifier 83 | 84 | 85 | StringsTable 86 | Acknowledgements 87 | Title 88 | Acknowledgements 89 | 90 | 91 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CarouselDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CarouselDemo 5 | @end 6 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | 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} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | 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} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | 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}" 115 | else 116 | 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}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_CarouselDemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_CarouselDemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PSCarouselView" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PSCarouselView/PSCarouselView.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "PSCarouselView" -framework "SDWebImage" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_CarouselDemo { 2 | umbrella header "Pods-CarouselDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/Pods-CarouselDemo/Pods-CarouselDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PSCarouselView" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PSCarouselView/PSCarouselView.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "PSCarouselView" -framework "SDWebImage" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/SDWebImage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.3.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "NSButton+WebCache.h" 14 | #import "NSData+ImageContentType.h" 15 | #import "NSImage+WebCache.h" 16 | #import "SDAnimatedImageRep.h" 17 | #import "SDImageCache.h" 18 | #import "SDImageCacheConfig.h" 19 | #import "SDWebImageCoder.h" 20 | #import "SDWebImageCoderHelper.h" 21 | #import "SDWebImageCodersManager.h" 22 | #import "SDWebImageCompat.h" 23 | #import "SDWebImageDownloader.h" 24 | #import "SDWebImageDownloaderOperation.h" 25 | #import "SDWebImageFrame.h" 26 | #import "SDWebImageGIFCoder.h" 27 | #import "SDWebImageImageIOCoder.h" 28 | #import "SDWebImageManager.h" 29 | #import "SDWebImageOperation.h" 30 | #import "SDWebImagePrefetcher.h" 31 | #import "SDWebImageTransition.h" 32 | #import "UIButton+WebCache.h" 33 | #import "UIImage+ForceDecode.h" 34 | #import "UIImage+GIF.h" 35 | #import "UIImage+MultiFormat.h" 36 | #import "UIImageView+HighlightedWebCache.h" 37 | #import "UIImageView+WebCache.h" 38 | #import "UIView+WebCache.h" 39 | #import "UIView+WebCacheOperation.h" 40 | 41 | FOUNDATION_EXPORT double SDWebImageVersionNumber; 42 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; 43 | 44 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CarouselDemo/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = -framework "ImageIO" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/Classes/PSCarouselCollectionCell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PSCarouselCollectionCell Class Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | PSCarouselView 18 |

19 | 20 |

21 | Shengpan 22 |

23 | 24 |
25 |
26 | 27 | 75 | 76 |
77 |
78 |
79 |
80 |

PSCarouselCollectionCell Class Reference

81 | 82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 |
Inherits fromUICollectionViewCell
Declared inPSCarouselCollectionCell.h
PSCarouselCollectionCell.m
92 | 93 | 94 | 95 | 96 |
97 | 98 |

Overview

99 |

轮播控件采用的Cell

100 |
101 | 102 | 103 | 104 | 105 | 106 |
107 | 108 | 109 | 110 | 111 | 112 | 113 |
114 |
115 | 116 |

  adImageView 117 |

118 | 119 |
120 |
121 | 122 |
123 | 124 | 125 |
126 |

显示轮播图的Cell

127 |
128 | 129 | 130 | 131 |
@property (strong, nonatomic) IBOutlet UIImageView *adImageView
132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 |

Declared In

149 |

PSCarouselCollectionCell.h

150 |
151 | 152 | 153 |
154 |
155 |
156 |
157 | 158 |
159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 | 167 |
168 | 176 |
177 |
178 |
179 |
180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/Classes/PSWeaker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PSWeaker Class Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | PSCarouselView 18 |

19 | 20 |

21 | Shengpan 22 |

23 | 24 |
25 |
26 | 27 | 75 | 76 |
77 |
78 |
79 |
80 |

PSWeaker Class Reference

81 | 82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 |
Inherits fromNSObject
Declared inPSWeaker.h
PSWeaker.m
92 | 93 | 94 | 95 | 96 |
97 | 98 |

Overview

99 |

本类用于解决某些系统类造成的循环引用问题,比如说NSTimer。

100 |
101 | 102 | 103 | 104 | 105 | 106 |
107 | 108 | 109 | 110 | 111 | 112 | 113 |
114 |
115 | 116 |

– initWithObject: 117 |

118 | 119 |
120 |
121 | 122 |
123 | 124 | 125 |
126 |

初始化一个weaker,并弱引用被传入的对象

127 |
128 | 129 | 130 | 131 |
- (instancetype)initWithObject:(id)object
132 | 133 | 134 | 135 |
136 |

Parameters

137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 |
object

需要被弱引用的对象

145 |
146 | 147 | 148 | 149 |
150 |

Return Value

151 |

一个弱引用了指定对象的Weaker。

152 |
153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 |
165 |

Declared In

166 |

PSWeaker.h

167 |
168 | 169 | 170 |
171 |
172 |
173 |
174 | 175 |
176 | 177 | 178 | 179 | 180 | 181 | 182 |
183 | 184 |
185 | 193 |
194 |
195 |
196 |
197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/_index.scss: -------------------------------------------------------------------------------- 1 | .index-container { 2 | -webkit-flex-direction: column; 3 | flex-direction: column; 4 | 5 | @media (min-width: $desktop-min-width) { 6 | display: flex; 7 | -webkit-flex-direction: row; 8 | flex-direction: row; 9 | -webkit-flex-wrap: wrap; 10 | flex-wrap: wrap; 11 | } 12 | 13 | .index-column { 14 | -webkit-flex: 1 1 33%; 15 | flex: 1 1 33%; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/_layout.scss: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | .clear { 6 | clear: both; 7 | } 8 | 9 | .clearfix { 10 | &:before, &:after { 11 | clear: both; 12 | display: table; 13 | content: ""; 14 | } 15 | } 16 | 17 | .xcode .hide-in-xcode { 18 | display: none; 19 | } 20 | 21 | body { 22 | font: 62.5% $body-font; 23 | background: $body-background; 24 | 25 | @media (max-width: $mobile-max-width) { 26 | background-color: $content-background; 27 | } 28 | } 29 | 30 | h1, h2, h3 { 31 | font-weight: 300; 32 | color: #808080; 33 | } 34 | 35 | h1 { 36 | font-size: 2em; 37 | color: #000; 38 | } 39 | 40 | h4 { 41 | font-size: 13px; 42 | line-height: 1.5; 43 | margin: 21px 0 0 0; 44 | } 45 | 46 | a { 47 | color: $tint-color; 48 | text-decoration: none; 49 | } 50 | 51 | pre, code { 52 | font-family: $code-font; 53 | word-wrap: break-word; 54 | } 55 | 56 | pre > code, .method-declaration code { 57 | display: inline-block; 58 | font-size: .85em; 59 | padding: 4px 0 4px 10px; 60 | border-left: 5px solid rgba(0, 155, 51, .2); 61 | 62 | &:before { 63 | content: "Objective-C"; 64 | display: block; 65 | 66 | font: 9px/1 $body-font; 67 | color: #009b33; 68 | text-transform: uppercase; 69 | letter-spacing: 2px; 70 | padding-bottom: 6px; 71 | } 72 | } 73 | 74 | pre > code { 75 | font-size: inherit; 76 | } 77 | 78 | table, th, td { 79 | border: 1px solid #e9e9e9; 80 | } 81 | 82 | table { 83 | width: 100%; 84 | } 85 | 86 | th, td { 87 | padding: 7px; 88 | 89 | > :first-child { 90 | margin-top: 0; 91 | } 92 | 93 | > :last-child { 94 | margin-bottom: 0; 95 | } 96 | } 97 | 98 | .container { 99 | @extend .clearfix; 100 | 101 | max-width: 980px; 102 | padding: 0 10px; 103 | margin: 0 auto; 104 | 105 | @media (max-width: $mobile-max-width) { 106 | padding: 0; 107 | } 108 | } 109 | 110 | header { 111 | position: fixed; 112 | top: 0; 113 | left: 0; 114 | width: 100%; 115 | z-index: 2; 116 | 117 | background: #414141; 118 | color: #fff; 119 | font-size: 1.1em; 120 | line-height: 25px; 121 | letter-spacing: .05em; 122 | 123 | #library-title { 124 | float: left; 125 | } 126 | 127 | #developer-home { 128 | float: right; 129 | } 130 | 131 | h1 { 132 | font-size: inherit; 133 | font-weight: inherit; 134 | margin: 0; 135 | } 136 | 137 | p { 138 | margin: 0; 139 | } 140 | 141 | h1, a { 142 | color: inherit; 143 | } 144 | 145 | @media (max-width: $mobile-max-width) { 146 | .container { 147 | padding: 0 10px; 148 | } 149 | } 150 | } 151 | 152 | aside { 153 | position: fixed; 154 | top: 25px; 155 | left: 0; 156 | width: 100%; 157 | height: 25px; 158 | z-index: 2; 159 | 160 | font-size: 1.1em; 161 | 162 | #header-buttons { 163 | background: rgba(255, 255, 255, .8); 164 | margin: 0 1px; 165 | padding: 0; 166 | list-style: none; 167 | text-align: right; 168 | line-height: 32px; 169 | 170 | li { 171 | display: inline-block; 172 | cursor: pointer; 173 | padding: 0 10px; 174 | } 175 | 176 | label, select { 177 | cursor: inherit; 178 | } 179 | 180 | #on-this-page { 181 | position: relative; 182 | 183 | .chevron { 184 | display: inline-block; 185 | width: 14px; 186 | height: 4px; 187 | position: relative; 188 | 189 | .chevy { 190 | background: #878787; 191 | height: 2px; 192 | position: absolute; 193 | width: 10px; 194 | 195 | &.chevron-left { 196 | left: 0; 197 | transform: rotateZ(45deg) scale(0.6); 198 | } 199 | 200 | &.chevron-right { 201 | right: 0; 202 | transform: rotateZ(-45deg) scale(0.6); 203 | } 204 | } 205 | } 206 | 207 | #jump-to { 208 | opacity: 0; 209 | font-size: 16px; 210 | 211 | position: absolute; 212 | top: 5px; 213 | left: 0; 214 | width: 100%; 215 | height: 100%; 216 | } 217 | } 218 | } 219 | } 220 | 221 | article { 222 | margin-top: 25px; 223 | 224 | #content { 225 | @extend .clearfix; 226 | 227 | background: $content-background; 228 | border: 1px solid $content-border; 229 | padding: 15px 25px 30px 25px; 230 | 231 | font-size: 1.4em; 232 | line-height: 1.45; 233 | 234 | position: relative; 235 | 236 | @media (max-width: $mobile-max-width) { 237 | padding: 15px 10px 20px 10px; 238 | border: none; 239 | } 240 | 241 | .navigation-top { 242 | position: absolute; 243 | top: 15px; 244 | right: 25px; 245 | } 246 | 247 | .title { 248 | margin: 21px 0 0 0; 249 | padding: 15px 0; 250 | } 251 | 252 | p { 253 | color: #414141; 254 | margin: 0 0 15px 0; 255 | } 256 | 257 | th, td { 258 | p:last-child { 259 | margin-bottom: 0; 260 | } 261 | } 262 | 263 | main { 264 | ul { 265 | list-style: none; 266 | margin-left: 24px; 267 | margin-bottom: 12px; 268 | padding: 0; 269 | 270 | li { 271 | position: relative; 272 | padding-left: 1.3em; 273 | 274 | &:before { 275 | content: "\02022"; 276 | 277 | color: #414141; 278 | font-size: 1.08em; 279 | line-height: 1; 280 | 281 | position: absolute; 282 | left: 0; 283 | padding-top: 2px; 284 | } 285 | } 286 | } 287 | } 288 | 289 | footer { 290 | @extend .clearfix; 291 | 292 | .footer-copyright { 293 | margin: 70px 25px 10px 0; 294 | } 295 | 296 | p { 297 | font-size: .71em; 298 | color: #a0a0a0; 299 | } 300 | } 301 | } 302 | } 303 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/_object.scss: -------------------------------------------------------------------------------- 1 | .section-specification { 2 | table { 3 | width: auto; 4 | 5 | th { 6 | text-align: left; 7 | } 8 | } 9 | } 10 | 11 | .method-title { 12 | margin-left: -15px; 13 | margin-bottom: 8px; 14 | transition: margin-left .3s ease-out; 15 | 16 | .section-method.hide & { 17 | margin-left: 0; 18 | } 19 | 20 | code { 21 | font-weight: 400; 22 | font-size: .85em; 23 | } 24 | } 25 | 26 | .method-info { 27 | background: $object-background; 28 | border-bottom: 1px solid $object-border; 29 | margin: 0 -25px; 30 | padding: 20px 25px 0 25px; 31 | transition: height .3s ease-out; 32 | 33 | position: relative; 34 | 35 | .pointy-thing { 36 | background: $content-background; 37 | height: 10px; 38 | border-bottom: 1px solid $object-border; 39 | margin: -20px -25px 16px -25px; 40 | 41 | &:before { 42 | display: inline-block; 43 | content: ""; 44 | 45 | background: $object-background; 46 | border: 1px solid $object-border; 47 | border-bottom: 0; 48 | border-right: 0; 49 | 50 | position: absolute; 51 | left: 21px; 52 | top: 3px; 53 | width: 12px; 54 | height: 12px; 55 | transform: rotate(45deg); 56 | } 57 | } 58 | 59 | .method-subsection { 60 | margin-bottom: 15px; 61 | 62 | .argument-name { 63 | width: 1px; 64 | text-align: right; 65 | 66 | code { 67 | color: #808080; 68 | font-style: italic; 69 | font-weight: 400; 70 | } 71 | } 72 | } 73 | } 74 | 75 | .section-method { 76 | &.hide .method-info { 77 | height: 0 !important; 78 | overflow: hidden; 79 | display: none; 80 | } 81 | 82 | &.hide.animating .method-info { 83 | display: block; 84 | } 85 | 86 | &.animating .method-info { 87 | overflow: hidden; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/_print.scss: -------------------------------------------------------------------------------- 1 | @media print { 2 | body { 3 | background: #fff; 4 | padding: 8px; 5 | } 6 | 7 | header { 8 | position: static; 9 | background: #fff; 10 | color: #000; 11 | } 12 | 13 | aside { 14 | display: none; 15 | } 16 | 17 | .container { 18 | max-width: none; 19 | padding: 0; 20 | } 21 | 22 | article { 23 | margin-top: 0; 24 | 25 | #content { 26 | border: 0; 27 | background: #fff; 28 | padding: 15px 0 0 0; 29 | 30 | .title { 31 | margin-top: 0; 32 | padding-top: 0; 33 | } 34 | } 35 | } 36 | 37 | .method-info { 38 | &, & .pointy-thing { 39 | background: #fff; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/_variables.scss: -------------------------------------------------------------------------------- 1 | $body-font: -apple-system-font, "Helvetica Neue", Helvetica, sans-serif; 2 | $code-font: "Source Code Pro", Monaco, Menlo, Consolas, monospace; 3 | 4 | $body-background: #f2f2f2; 5 | $content-background: #fff; 6 | $content-border: #e9e9e9; 7 | $tint-color: #08c; 8 | $object-background: #f9f9f9; 9 | $object-border: #e9e9e9; 10 | 11 | $mobile-max-width: 650px; 12 | $desktop-min-width: 768px; -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/_xcode.scss: -------------------------------------------------------------------------------- 1 | .xcode { 2 | header, aside { 3 | display: none; 4 | } 5 | 6 | .container { 7 | padding: 0; 8 | } 9 | 10 | article { 11 | margin-top: 0; 12 | 13 | #content { 14 | border: 0; 15 | margin: 0; 16 | } 17 | } 18 | 19 | .method-info { 20 | &, .section-method.hide & { 21 | max-height: auto; 22 | overflow: visible; 23 | 24 | &.hiding { 25 | display: block; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/scss/style.scss: -------------------------------------------------------------------------------- 1 | @import "variables", "normalize", "layout", "index", "object", "print", "xcode"; 2 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/css/style.css: -------------------------------------------------------------------------------- 1 | html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:border-box}.clear{clear:both}.clearfix:before,.container:before,article #content:before,article #content footer:before,.clearfix:after,.container:after,article #content:after,article #content footer:after{clear:both;display:table;content:""}.xcode .hide-in-xcode{display:none}body{font:62.5% -apple-system-font,"Helvetica Neue",Helvetica,sans-serif;background:#f2f2f2}@media (max-width: 650px){body{background-color:#fff}}h1,h2,h3{font-weight:300;color:#808080}h1{font-size:2em;color:#000}h4{font-size:13px;line-height:1.5;margin:21px 0 0 0}a{color:#08c;text-decoration:none}pre,code{font-family:"Source Code Pro",Monaco,Menlo,Consolas,monospace;word-wrap:break-word}pre>code,.method-declaration code{display:inline-block;font-size:.85em;padding:4px 0 4px 10px;border-left:5px solid rgba(0,155,51,0.2)}pre>code:before,.method-declaration code:before{content:"Objective-C";display:block;font:9px/1 -apple-system-font,"Helvetica Neue",Helvetica,sans-serif;color:#009b33;text-transform:uppercase;letter-spacing:2px;padding-bottom:6px}pre>code{font-size:inherit}table,th,td{border:1px solid #e9e9e9}table{width:100%}th,td{padding:7px}th>:first-child,td>:first-child{margin-top:0}th>:last-child,td>:last-child{margin-bottom:0}.container{max-width:980px;padding:0 10px;margin:0 auto}@media (max-width: 650px){.container{padding:0}}header{position:fixed;top:0;left:0;width:100%;z-index:2;background:#414141;color:#fff;font-size:1.1em;line-height:25px;letter-spacing:.05em}header #library-title{float:left}header #developer-home{float:right}header h1{font-size:inherit;font-weight:inherit;margin:0}header p{margin:0}header h1,header a{color:inherit}@media (max-width: 650px){header .container{padding:0 10px}}aside{position:fixed;top:25px;left:0;width:100%;height:25px;z-index:2;font-size:1.1em}aside #header-buttons{background:rgba(255,255,255,0.8);margin:0 1px;padding:0;list-style:none;text-align:right;line-height:32px}aside #header-buttons li{display:inline-block;cursor:pointer;padding:0 10px}aside #header-buttons label,aside #header-buttons select{cursor:inherit}aside #header-buttons #on-this-page{position:relative}aside #header-buttons #on-this-page .chevron{display:inline-block;width:14px;height:4px;position:relative}aside #header-buttons #on-this-page .chevron .chevy{background:#878787;height:2px;position:absolute;width:10px}aside #header-buttons #on-this-page .chevron .chevy.chevron-left{left:0;transform:rotateZ(45deg) scale(0.6)}aside #header-buttons #on-this-page .chevron .chevy.chevron-right{right:0;transform:rotateZ(-45deg) scale(0.6)}aside #header-buttons #on-this-page #jump-to{opacity:0;font-size:16px;position:absolute;top:5px;left:0;width:100%;height:100%}article{margin-top:25px}article #content{background:#fff;border:1px solid #e9e9e9;padding:15px 25px 30px 25px;font-size:1.4em;line-height:1.45;position:relative}@media (max-width: 650px){article #content{padding:15px 10px 20px 10px;border:none}}article #content .navigation-top{position:absolute;top:15px;right:25px}article #content .title{margin:21px 0 0 0;padding:15px 0}article #content p{color:#414141;margin:0 0 15px 0}article #content th p:last-child,article #content td p:last-child{margin-bottom:0}article #content main ul{list-style:none;margin-left:24px;margin-bottom:12px;padding:0}article #content main ul li{position:relative;padding-left:1.3em}article #content main ul li:before{content:"\02022";color:#414141;font-size:1.08em;line-height:1;position:absolute;left:0;padding-top:2px}article #content footer .footer-copyright{margin:70px 25px 10px 0}article #content footer p{font-size:.71em;color:#a0a0a0}.index-container{-webkit-flex-direction:column;flex-direction:column}@media (min-width: 768px){.index-container{display:flex;-webkit-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;flex-wrap:wrap}}.index-container .index-column{-webkit-flex:1 1 33%;flex:1 1 33%}.section-specification table{width:auto}.section-specification table th{text-align:left}.method-title{margin-left:-15px;margin-bottom:8px;transition:margin-left .3s ease-out}.section-method.hide .method-title{margin-left:0}.method-title code{font-weight:400;font-size:.85em}.method-info{background:#f9f9f9;border-bottom:1px solid #e9e9e9;margin:0 -25px;padding:20px 25px 0 25px;transition:height .3s ease-out;position:relative}.method-info .pointy-thing{background:#fff;height:10px;border-bottom:1px solid #e9e9e9;margin:-20px -25px 16px -25px}.method-info .pointy-thing:before{display:inline-block;content:"";background:#f9f9f9;border:1px solid #e9e9e9;border-bottom:0;border-right:0;position:absolute;left:21px;top:3px;width:12px;height:12px;-webkit-transform:rotate(45deg);transform:rotate(45deg) }.method-info .method-subsection{margin-bottom:15px}.method-info .method-subsection .argument-name{width:1px;text-align:right}.method-info .method-subsection .argument-name code{color:#808080;font-style:italic;font-weight:400}.section-method.hide .method-info{height:0 !important;overflow:hidden;display:none}.section-method.hide.animating .method-info{display:block}.section-method.animating .method-info{overflow:hidden}@media print{body{background:#fff;padding:8px}header{position:static;background:#fff;color:#000}aside{display:none}.container{max-width:none;padding:0}article{margin-top:0}article #content{border:0;background:#fff;padding:15px 0 0 0}article #content .title{margin-top:0;padding-top:0}.method-info,.method-info .pointy-thing{background:#fff}}.xcode header,.xcode aside{display:none}.xcode .container{padding:0}.xcode article{margin-top:0}.xcode article #content{border:0;margin:0}.xcode .method-info,.section-method.hide .xcode .method-info{max-height:auto;overflow:visible}.xcode .method-info.hiding,.section-method.hide .xcode .method-info.hiding{display:block} 2 | 3 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/hierarchy.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PSCarouselView Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | PSCarouselView 18 |

19 | 20 |

21 | Shengpan 22 |

23 | 24 |
25 |
26 | 27 | 36 | 37 |
38 |
39 |
40 |
41 |

PSCarouselView Hierarchy

42 | 43 | 44 |
45 |

Class Hierarchy

46 | 47 | 74 | 75 |
76 | 77 | 78 | 79 |
80 | 81 |

Protocol References

82 | 87 | 88 | 89 | 90 |
91 | 92 | 93 |
94 | 102 |
103 |
104 |
105 |
106 |
107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/img/button_bar_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/doc/html/img/button_bar_background.png -------------------------------------------------------------------------------- /CarouselDemo/doc/html/img/disclosure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/doc/html/img/disclosure.png -------------------------------------------------------------------------------- /CarouselDemo/doc/html/img/disclosure_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/doc/html/img/disclosure_open.png -------------------------------------------------------------------------------- /CarouselDemo/doc/html/img/library_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/doc/html/img/library_background.png -------------------------------------------------------------------------------- /CarouselDemo/doc/html/img/title_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/CarouselDemo/doc/html/img/title_background.png -------------------------------------------------------------------------------- /CarouselDemo/doc/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PSCarouselView Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | PSCarouselView 18 |

19 | 20 |

21 | Shengpan 22 |

23 | 24 |
25 |
26 | 27 | 36 | 37 |
38 |
39 |
40 |
41 |

PSCarouselView Reference

42 | 43 | 44 | 45 |
46 | 47 | 48 | 49 |
50 |

Class References

51 | 60 |
61 | 62 | 63 | 64 |
65 | 66 |

Protocol References

67 | 72 | 73 | 74 | 75 | 76 | 77 |
78 | 79 |
80 | 81 |
82 | 90 |
91 |
92 |
93 |
94 |
95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /CarouselDemo/doc/html/js/script.js: -------------------------------------------------------------------------------- 1 | function $() { 2 | return document.querySelector.apply(document, arguments); 3 | } 4 | 5 | if (navigator.userAgent.indexOf("Xcode") != -1) { 6 | document.documentElement.classList.add("xcode"); 7 | } 8 | 9 | var jumpTo = $("#jump-to"); 10 | 11 | if (jumpTo) { 12 | jumpTo.addEventListener("change", function(e) { 13 | location.hash = this.options[this.selectedIndex].value; 14 | }); 15 | } 16 | 17 | function hashChanged() { 18 | if (/^#\/\/api\//.test(location.hash)) { 19 | var element = document.querySelector("a[name='" + location.hash.substring(1) + "']"); 20 | 21 | if (!element) { 22 | return; 23 | } 24 | 25 | element = element.parentNode; 26 | 27 | element.classList.remove("hide"); 28 | fixScrollPosition(element); 29 | } 30 | } 31 | 32 | function fixScrollPosition(element) { 33 | var scrollTop = element.offsetTop - 150; 34 | document.documentElement.scrollTop = scrollTop; 35 | document.body.scrollTop = scrollTop; 36 | } 37 | 38 | [].forEach.call(document.querySelectorAll(".section-method"), function(element) { 39 | element.classList.add("hide"); 40 | 41 | element.querySelector(".method-title a").addEventListener("click", function(e) { 42 | var info = element.querySelector(".method-info"), 43 | infoContainer = element.querySelector(".method-info-container"); 44 | 45 | element.classList.add("animating"); 46 | info.style.height = (infoContainer.clientHeight + 40) + "px"; 47 | fixScrollPosition(element); 48 | element.classList.toggle("hide"); 49 | if (element.classList.contains("hide")) { 50 | e.preventDefault(); 51 | } 52 | setTimeout(function() { 53 | element.classList.remove("animating"); 54 | }, 300); 55 | }); 56 | }); 57 | 58 | window.addEventListener("hashchange", hashChanged); 59 | hashChanged(); 60 | -------------------------------------------------------------------------------- /CarouselDemo/fastlane/.env: -------------------------------------------------------------------------------- 1 | DEPLOY_BRANCH=master 2 | DEPLOY_PLIST_PATH=CarouselDemo/SupportingFile/Info.plist 3 | DEPLOY_PODSPEC=../PSCarouselView.podspec 4 | DEPLOY_REMOTE=origin -------------------------------------------------------------------------------- /CarouselDemo/fastlane/Appfile: -------------------------------------------------------------------------------- 1 | app_identifier "net.shengpan.CarouselDemo" # The bundle identifier of your app 2 | apple_id "developerpans@163.com" # Your Apple email address 3 | 4 | team_id "2U4X7NE3S9" # Developer Portal Team ID 5 | 6 | # you can even provide different app identifiers, Apple IDs and team names per lane: 7 | # More information: https://github.com/fastlane/fastlane/blob/master/docs/Appfile.md 8 | -------------------------------------------------------------------------------- /CarouselDemo/fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | # Customise this file, documentation can be found here: 2 | # https://github.com/fastlane/fastlane/tree/master/docs 3 | # All available actions: https://github.com/fastlane/fastlane/blob/master/docs/Actions.md 4 | # can also be listed using the `fastlane actions` command 5 | 6 | # Change the syntax highlighting to Ruby 7 | # All lines starting with a # are ignored when running `fastlane` 8 | 9 | # By default, fastlane will send which actions are used 10 | # No personal data is shared, more information on https://github.com/fastlane/enhancer 11 | # Uncomment the following line to opt out 12 | # opt_out_usage 13 | 14 | # If you want to automatically update fastlane if a new version is available: 15 | # update_fastlane 16 | 17 | # This is the minimum version number required. 18 | # Update this, if you use features of a newer version 19 | # import_from_git( 20 | # url: 'https://github.com/AFNetworking/fastlane.git', 21 | # branch: '0.0.6' 22 | # ) 23 | 24 | fastlane_version "1.64.0" 25 | 26 | default_platform :ios 27 | 28 | platform :ios do 29 | before_all do 30 | # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." 31 | 32 | 33 | end 34 | 35 | desc "Runs all the tests" 36 | lane :test do 37 | scan 38 | end 39 | 40 | desc "Submit a new Beta Build to Apple TestFlight" 41 | desc "This will also make sure the profile is up to date" 42 | lane :beta do 43 | # match(type: "appstore") # more information: https://codesigning.guide 44 | gym # Build your app - more options available 45 | pilot 46 | 47 | # sh "your_script.sh" 48 | # You can also use other beta testing services here (run `fastlane actions`) 49 | end 50 | 51 | desc "Deploy a new version to the App Store" 52 | lane :appstore do 53 | # match(type: "appstore") 54 | # snapshot 55 | gym # Build your app - more options available 56 | deliver(force: true) 57 | # frameit 58 | end 59 | 60 | # You can define as many lanes as you want 61 | 62 | after_all do |lane| 63 | # This block is called, only if the executed lane was successful 64 | 65 | # slack( 66 | # message: "Successfully deployed new App Update." 67 | # ) 68 | end 69 | 70 | error do |lane, exception| 71 | # slack( 72 | # message: exception.message, 73 | # success: false 74 | # ) 75 | end 76 | end 77 | 78 | 79 | 80 | # More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/docs/Platforms.md 81 | # All available actions: https://github.com/fastlane/fastlane/blob/master/docs/Actions.md 82 | -------------------------------------------------------------------------------- /Inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/Inspector.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sheng Pan 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 | -------------------------------------------------------------------------------- /PSCarouselView.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/PSCarouselView.gif -------------------------------------------------------------------------------- /PSCarouselView.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "PSCarouselView" 5 | s.version = "1.6.1" 6 | s.summary = "A drop-in carousel view. Most of Apps put it in their first screen." 7 | s.description = <<-DESC 8 | A drop-in carousel view. Most of Apps put it in their first screen.Ease use and quick compose. 9 | DESC 10 | s.homepage = "http://shengpan.net/pscarouselview/" 11 | s.screenshots = "https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/PSCarouselView.gif" 12 | s.license = "MIT" 13 | s.author = { "Pan" => "developerpans@163.com" } 14 | s.social_media_url = 'http://shengpan.net' 15 | s.platform = :ios, '7.0' 16 | s.requires_arc = true 17 | s.source = { :git => "https://github.com/DeveloperPans/PSCarouselView.git", :tag => s.version.to_s } 18 | s.source_files = 'CarouselDemo/PSCarouselView/**/*.{h,m}' 19 | s.resource_bundle = { 'PSCarouselView' => 'CarouselDemo/PSCarouselView/*.xib' } 20 | s.frameworks = 'UIKit' 21 | s.dependency 'SDWebImage' 22 | 23 | end 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | Logo 4 |

5 |

6 | PSCarouselView Logo 7 |

8 | 9 | 10 | # PSCarouselView 11 | 12 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/cf2dd4cfa809491e9513a69d538157c4)](https://app.codacy.com/app/DeveloperPans/PSCarouselView?utm_source=github.com&utm_medium=referral&utm_content=DeveloperPans/PSCarouselView&utm_campaign=Badge_Grade_Dashboard) 13 | [![docs][docs]][CocoaPods] 14 | [![Pod Version][version]][CocoaPods] 15 | [![License][license]][CocoaPods] 16 | [![Platform][platform]][CocoaPods] 17 | ![SwiftCompatible][SwiftCompatible] 18 | 19 | A drop-in carousel view. Most Applications put it in their first screen. [中文](https://github.com/DeveloperPans/PSCarouselView/blob/master/README_CN.md) 20 | 21 | --- 22 | 23 | ### Preview 24 | ![image](https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/PSCarouselView.gif) 25 | 26 | #### **Enhancement** 27 | 28 | Storyboard inspector supported since version **1.1.0** 29 | 30 | ![image](https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/Inspector.png) 31 | 32 | 33 | ### Installation with CocoaPods 34 | 35 | Specify it in your `podfile`: 36 | 37 | ```ruby 38 | pod 'PSCarouselView' 39 | ``` 40 | 41 | Then, run the following command: 42 | 43 | ```bash 44 | $ pod install 45 | ``` 46 | 47 | ### Install manually 48 | 49 | Clone project, add `PSCarouselView` folder to your project and don't forget check the *copy item if needed* box. 50 | 51 | `SDWebImage` framework **required**. Make sure you had imported `SDWebImage` when install `PSCarouselView` manually. 52 | 53 | ### Getting Start 54 | 55 | 1.Drag a `UICollectionView` into your Storyboard and make sure your constraints has been set. 56 | 57 | 2.Set `PSCarouselView` as a custom class for this collectionView in Storyboard Inspector. 58 | 59 | ![custom class](https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/customclass.png) 60 | 61 | 3.Connect `IBOutlet` to Your ViewController. 62 | 63 | ```objc 64 | @interface ViewController () 65 | 66 | @property (weak, nonatomic) IBOutlet PSCarouselView *carouselView; 67 | ``` 68 | 69 | 4.Set value for PSCarouselView's `imageURL` property. 70 | 71 | 5.Implement `PSCarouselDelegate` if you want to make a pageControl. 72 | 73 | ```objc 74 | - (void)carousel:(PSCarouselView *)carousel didMoveToPage:(NSUInteger)page 75 | { 76 | self.pageControl.currentPage = page; 77 | } 78 | 79 | - (void)carousel:(PSCarouselView *)carousel didTouchPage:(NSUInteger)page 80 | { 81 | NSLog(@"PSCarouselView did TOUCH No.%ld page",page); 82 | } 83 | ``` 84 | 85 | ### API Reference 86 | 87 | [shengpan.net](http://doc.shengpan.net/Classes/PSCarouselView.html) or [CocoaPods Doc](http://cocoadocs.org/docsets/PSCarouselView/1.3.0) 88 | 89 | For more,download and see the demo。 90 | 91 | ## LICENSE 92 | 93 | [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89) 94 | 95 | [CocoaPods]: http://cocoapods.org/pods/PSCarouselView 96 | 97 | [travis]: (https://travis-ci.org/DeveloperPans/PSCarouselView) 98 | 99 | [docs]: https://img.shields.io/badge/docs-100%25-brightgreen.svg 100 | 101 | [version]: https://img.shields.io/cocoapods/v/PSCarouselView.svg?style=flat 102 | 103 | [status]: https://travis-ci.org/DeveloperPans/PSCarouselView.svg?branch=master 104 | 105 | [license]: https://img.shields.io/cocoapods/l/PSCarouselView.svg?style=flat 106 | 107 | [platform]: https://img.shields.io/cocoapods/p/PSCarouselView.svg?style=flat 108 | 109 | [SwiftCompatible]: https://img.shields.io/badge/Swift-compatible-orange.svg 110 | 111 | [blog]: http://shengpan.net 112 | 113 | 114 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # PSCarouselView 2 | 扔进你的项目就可以用了!实现了很多app都需要的首页广告轮播功能。 3 | 4 | #### **版本更新** 5 | 6 | `enhancement` 从`1.1.0`版本开始,支持故事板直接编辑属性,不用再写那么多初始化代码啦! 7 | 8 | ![image](https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/Inspector.png) 9 | 10 | ### 预览图 11 | ![image](https://raw.githubusercontent.com/DeveloperPans/PSCarouselView/master/PSCarouselView.gif) 12 | 13 | ### 导入库 14 | ##### `推荐`使用CocoaPods导入 15 | 在你的podfile文件中加入如下一行 16 | 17 | pod 'PSCarouselView' 18 | 19 | ##### 下载并手动导入 20 | 下载zip,解压并把`PSCarouselView`文件夹以及里面的文件添加到你的工程。 21 | 22 | 23 | ### 使用方法 24 | 1. Storyboard拖拽一个`UICollectionView`到你要放轮播的位置,约束好大小 25 | 2. Storyboard中将这个`CollectionView`的类设置为`PSCarouselView` 26 | 3. 连接`IBOutlet`到`ViewController` 27 | 4. 给carouselView的*`imageURL`*赋值。 28 | 29 | ### 注意: 30 | 1. 如果你想做个pageControl,请实现代理方法。 31 | 2. 控件需要使用SDWebImage,不使用CocoaPods的情况下,请确保你的工程中导入了SDWebImage。 32 | 33 | ### 文档 34 | 35 | API文档详见 [shengpan.net](http://doc.shengpan.net/Classes/PSCarouselView.html) 或者 [CocoaPods Doc](http://cocoadocs.org/docsets/PSCarouselView/1.3.0) 36 | 37 | 详情请参阅Demo 38 | 39 | -------------------------------------------------------------------------------- /customclass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/customclass.png -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/logo.png -------------------------------------------------------------------------------- /logo.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrPans/PSCarouselView/fc596fe7140f65bf57bab4565c135195f78e0572/logo.sketch --------------------------------------------------------------------------------