diff --git a/JCECircularCollectionViewExample/Podfile b/JCECircularCollectionViewExample/Podfile index a7c1a55..c943d98 100644 --- a/JCECircularCollectionViewExample/Podfile +++ b/JCECircularCollectionViewExample/Podfile @@ -3,7 +3,7 @@ target 'JCECircularCollectionViewExample' do -pod 'CircularCollectionView', '~> 1.2' +pod 'CircularCollectionView', '~> 1.3' end diff --git a/JCECircularCollectionViewExample/Podfile.lock b/JCECircularCollectionViewExample/Podfile.lock index 2df97b1..0d8894a 100644 --- a/JCECircularCollectionViewExample/Podfile.lock +++ b/JCECircularCollectionViewExample/Podfile.lock @@ -1,10 +1,10 @@ PODS: - - CircularCollectionView (1.2) + - CircularCollectionView (1.3) DEPENDENCIES: - - CircularCollectionView (~> 1.2) + - CircularCollectionView (~> 1.3) SPEC CHECKSUMS: - CircularCollectionView: e1eaf193c5049aa4ba304e2ebe72c9844b4e0c59 + CircularCollectionView: 50fd4658d66af351c9689d60c89705924f3c71d4 COCOAPODS: 0.39.0 diff --git a/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.h b/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.h index 17df44c..806fe81 100644 --- a/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.h +++ b/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.h @@ -10,6 +10,8 @@ @class JCECircularCollectionViewController; +@protocol JCECircularCollectionViewControllerDelegate; + @protocol JCECircularCollectionViewControllerDataSource @required @@ -38,10 +40,23 @@ */ @property (nonatomic, weak) id datasource; +/** + * The delegate for the circular collection view. + */ +@property (nonatomic, weak) id delegate; + /** * This can be used to show the arrow for the selected controller. */ @property (nonatomic, assign) BOOL showArrow; @property (nonatomic, strong) UIColor *arrowColor; +- (NSInteger)currentSelectedIndex; + +@end + +@protocol JCECircularCollectionViewControllerDelegate + +- (void)circularCollectionViewController:(JCECircularCollectionViewController *)circularCollectionViewController didSelectTabAtIndex:(NSInteger)index; + @end diff --git a/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.m b/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.m index 766f248..bb976f1 100644 --- a/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.m +++ b/JCECircularCollectionViewExample/Pods/CircularCollectionView/JCECircularCollectionView/JCECircularCollectionViewController.m @@ -120,6 +120,20 @@ - (void)viewDidLayoutSubviews { } } +#pragma mark - Public methods + +- (NSInteger)currentSelectedIndex { + NSInteger currentIndex; + if (_currentIndex == 0) { + currentIndex = [_datasource numberOfItems] - 1; + } else if (_currentIndex == [_itemMetadataArray count] - 1) { + currentIndex = 0; + } else { + currentIndex = _currentIndex - 1; + } + return currentIndex; +} + #pragma mark - UICollectionViewDataSource methods - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { @@ -178,6 +192,9 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [_titleScrollView scrollRectToVisible:CGRectMake(viewWidth * (_itemsCount - 3) / _numberOfTitlesVisible, 0, viewWidth, kTitleViewHeight) animated:NO]; [self p_setTitleColorAtIndex:_itemsCount - 2]; } + if (self.delegate && [self.delegate respondsToSelector:@selector(circularCollectionViewController:didSelectTabAtIndex:)]) { + [self.delegate circularCollectionViewController:self didSelectTabAtIndex:[self currentSelectedIndex]]; + } } } @@ -219,6 +236,9 @@ - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { if (_currentIndex == 0) { [_circularCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:_itemsCount - 2 inSection:0] atScrollPosition:UICollectionViewScrollPositionRight animated:NO]; } + if (self.delegate && [self.delegate respondsToSelector:@selector(circularCollectionViewController:didSelectTabAtIndex:)]) { + [self.delegate circularCollectionViewController:self didSelectTabAtIndex:[self currentSelectedIndex]]; + } } } diff --git a/JCECircularCollectionViewExample/Pods/CircularCollectionView/README.md b/JCECircularCollectionViewExample/Pods/CircularCollectionView/README.md index d182669..1198dc8 100644 --- a/JCECircularCollectionViewExample/Pods/CircularCollectionView/README.md +++ b/JCECircularCollectionViewExample/Pods/CircularCollectionView/README.md @@ -1,4 +1,4 @@ -[![Version](https://img.shields.io/badge/pod-v1.0.0-brightgreen.svg)](http://cocoapods.org/pods/CircularCollectionView) +[![Version](https://img.shields.io/badge/pod-v1.2-brightgreen.svg)](http://cocoapods.org/pods/CircularCollectionView) [![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg)](http://cocoapods.org/pods/CircularCollectionView) [![Platform](https://img.shields.io/badge/platform-ios-lightgrey.svg)](http://cocoapods.org/pods/CircularCollectionView) @@ -12,7 +12,7 @@ This can be useful for presenting multiple view controllers in one screen in a n ## Pod You can use following command for integrating via cocoapods: ``` -pod 'CircularCollectionView' +pod 'CircularCollectionView', '~> 1.3' ``` ## Example (This is after 2 mins of integrating the controller.) diff --git a/JCECircularCollectionViewExample/Pods/Manifest.lock b/JCECircularCollectionViewExample/Pods/Manifest.lock index 2df97b1..0d8894a 100644 --- a/JCECircularCollectionViewExample/Pods/Manifest.lock +++ b/JCECircularCollectionViewExample/Pods/Manifest.lock @@ -1,10 +1,10 @@ PODS: - - CircularCollectionView (1.2) + - CircularCollectionView (1.3) DEPENDENCIES: - - CircularCollectionView (~> 1.2) + - CircularCollectionView (~> 1.3) SPEC CHECKSUMS: - CircularCollectionView: e1eaf193c5049aa4ba304e2ebe72c9844b4e0c59 + CircularCollectionView: 50fd4658d66af351c9689d60c89705924f3c71d4 COCOAPODS: 0.39.0