From 5ece50cc361e5673e782e86c19124699ba2c5e33 Mon Sep 17 00:00:00 2001 From: Jin Sun Date: Thu, 13 Sep 2018 11:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=90=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F=E9=94=99=E4=B9=B1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZJScrollPageView.xcodeproj/project.pbxproj | 24 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../UIViewController+ZJScrollPageController.h | 2 +- .../UIViewController+ZJScrollPageController.m | 7 + .../ZJScrollPageView/ZJContentView.m | 252 ++++++++---------- ZJScrollPageView/ZJTest1Controller.h | 2 +- .../ZJVc10Controller.m" | 2 +- .../ZJVc1Controller.m" | 4 +- 8 files changed, 159 insertions(+), 142 deletions(-) create mode 100644 ZJScrollPageView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ZJScrollPageView.xcodeproj/project.pbxproj b/ZJScrollPageView.xcodeproj/project.pbxproj index c8fbaa9..39ad277 100755 --- a/ZJScrollPageView.xcodeproj/project.pbxproj +++ b/ZJScrollPageView.xcodeproj/project.pbxproj @@ -169,7 +169,7 @@ 4B7429CF1CDD9C16009CC9B2 /* UIView+ZJFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+ZJFrame.h"; sourceTree = ""; }; 4B7429D01CDD9C16009CC9B2 /* UIView+ZJFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+ZJFrame.m"; sourceTree = ""; }; 4B7429D11CDD9C16009CC9B2 /* ZJContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZJContentView.h; sourceTree = ""; }; - 4B7429D21CDD9C16009CC9B2 /* ZJContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZJContentView.m; sourceTree = ""; }; + 4B7429D21CDD9C16009CC9B2 /* ZJContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZJContentView.m; sourceTree = ""; wrapsLines = 0; }; 4B7429D31CDD9C16009CC9B2 /* ZJTitleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZJTitleView.h; sourceTree = ""; }; 4B7429D41CDD9C16009CC9B2 /* ZJTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZJTitleView.m; sourceTree = ""; }; 4B7429D51CDD9C16009CC9B2 /* ZJScrollPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZJScrollPageView.h; sourceTree = ""; }; @@ -615,7 +615,7 @@ 4B0C06241CDC55080079E8F3 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = ZeroJ; TargetAttributes = { 4B0C062B1CDC55080079E8F3 = { @@ -791,13 +791,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -836,13 +846,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; diff --git a/ZJScrollPageView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ZJScrollPageView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ZJScrollPageView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.h b/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.h index 25e1f42..2886c06 100755 --- a/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.h +++ b/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.h @@ -15,7 +15,7 @@ @property (nonatomic, weak, readonly) UIViewController *zj_scrollViewController; @property (nonatomic, assign) NSInteger zj_currentIndex; - +@property (nonatomic, assign) BOOL zj_loaded; diff --git a/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.m b/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.m index 6b129eb..03dab96 100755 --- a/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.m +++ b/ZJScrollPageView/ZJScrollPageView/UIViewController+ZJScrollPageController.m @@ -33,5 +33,12 @@ - (NSInteger)zj_currentIndex { return [objc_getAssociatedObject(self, &ZJIndexKey) integerValue]; } +- (void)setZj_loaded:(BOOL)zj_loaded { + objc_setAssociatedObject(self, &(@selector(zj_loaded)), @(zj_loaded), OBJC_ASSOCIATION_ASSIGN); +} + +- (BOOL)zj_loaded { + return [objc_getAssociatedObject(self, &(@selector(zj_loaded))) boolValue]; +} @end diff --git a/ZJScrollPageView/ZJScrollPageView/ZJContentView.m b/ZJScrollPageView/ZJScrollPageView/ZJContentView.m index 1e974b8..02b70f6 100755 --- a/ZJScrollPageView/ZJScrollPageView/ZJContentView.m +++ b/ZJScrollPageView/ZJScrollPageView/ZJContentView.m @@ -8,6 +8,9 @@ #import "ZJContentView.h" +#define cellID @"cellID" +#define kChildVCKey(index) [NSString stringWithFormat:@"%ld", (long)(index)] + @interface ZJContentView () { CGFloat _oldOffSetX; BOOL _isLoadFirstView; @@ -26,23 +29,21 @@ @interface ZJContentView () *> *childVcsDic; -// 当前控制器 -@property (strong, nonatomic) UIViewController *currentChildVc; /// 如果类似cell缓存一样, 虽然创建的控制器少了, 但是每个页面每次都要重新加载数据, 否则显示的内容就会出错, 貌似还不如每个页面创建一个控制器好 //@property (strong, nonatomic) NSCache *cacheChildVcs; @property (assign, nonatomic) NSInteger currentIndex; @property (assign, nonatomic) NSInteger oldIndex; +@property (strong, nonatomic) NSIndexPath *indexPathWillDisplay; // 是否需要手动管理生命周期方法的调用 @property (assign, nonatomic) BOOL needManageLifeCycle; -// 滚动超过页面(直接设置contentOffSet导致) -@property (assign, nonatomic) BOOL scrollOverOnePage; + +@property (assign, nonatomic) BOOL trasitionAnimated; @end @implementation ZJContentView -#define cellID @"cellID" #pragma mark - life cycle @@ -121,7 +122,7 @@ - (void)receiveMemoryWarningHander:(NSNotificationCenter *)noti { __strong typeof(self) strongSelf = weakSelf; if (strongSelf) { if (childVc != strongSelf.currentChildVc) { - [_childVcsDic removeObjectForKey:key]; + [strongSelf.childVcsDic removeObjectForKey:key]; [ZJContentView removeChildVc:childVc]; } } @@ -171,24 +172,17 @@ - (void)didMoveToWindow { /** 给外界可以设置ContentOffSet的方法 */ - (void)setContentOffSet:(CGPoint)offset animated:(BOOL)animated { self.forbidTouchToAdjustPosition = YES; + self.trasitionAnimated = animated; NSInteger currentIndex = offset.x/self.collectionView.bounds.size.width; _oldIndex = _currentIndex; self.currentIndex = currentIndex; - _scrollOverOnePage = NO; - - NSInteger page = labs(_currentIndex-_oldIndex); - if (page>=2) {// 需要滚动两页以上的时候, 跳过中间页的动画 - _scrollOverOnePage = YES; - } - - [self.collectionView setContentOffset:offset animated:animated]; + [self.collectionView setContentOffset:offset animated:animated]; } /** 给外界刷新视图的方法 */ - (void)reload { - [self.childVcsDic enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, UIViewController * _Nonnull childVc, BOOL * _Nonnull stop) { [ZJContentView removeChildVc:childVc]; childVc = nil; @@ -351,6 +345,48 @@ - (void)didDisappearWithIndex:(NSInteger)index { } } +- (UIViewController *)createChildVcAtIndexPathIfNeeded:(NSIndexPath *)indexPath { + UIViewController *childVc = self.childVcsDic[kChildVCKey(indexPath.item)]; + if (! childVc) { + childVc = [self createChildVcAtIndexPath:indexPath]; + } + return childVc; +} + +- (UIViewController *)createChildVcAtIndexPath:(NSIndexPath *)indexPath { + UIViewController *childVc = self.childVcsDic[kChildVCKey(indexPath.item)]; + + NSAssert([_delegate respondsToSelector:@selector(childViewController:forIndex:)], @"必须设置代理和实现代理方法: %@", NSStringFromSelector(@selector(childViewController:forIndex:))); + childVc = [_delegate childViewController:childVc forIndex:indexPath.item]; + + NSAssert([childVc conformsToProtocol:@protocol(ZJScrollPageViewChildVcDelegate)], @"子控制器必须遵守ZJScrollPageViewChildVcDelegate协议"); + NSAssert(![childVc isKindOfClass:[UINavigationController class]], @"不要添加UINavigationController包装后的子控制器"); + + // 设置当前下标 + childVc.zj_currentIndex = indexPath.item; + self.childVcsDic[kChildVCKey(indexPath.item)] = childVc; + + return childVc; +} + +- (void)setupChildVcForCell:(UICollectionViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { + if (_currentIndex != indexPath.item) { + return; // 跳过中间的多页 + } + // 这里建立子控制器和父控制器的关系 + UIViewController *childVc = self.childVcsDic[kChildVCKey(indexPath.item)]; + if (childVc.zj_scrollViewController != self.parentViewController) { + [childVc willMoveToParentViewController:self.parentViewController]; + [self.parentViewController addChildViewController:childVc]; + } + childVc.view.frame = cell.contentView.bounds; + childVc.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [cell.contentView addSubview:childVc.view]; + [childVc didMoveToParentViewController:self.parentViewController]; + childVc.zj_loaded = YES; + // NSLog(@"当前的index:%ld", indexPath.item); +} + #pragma mark - UICollectionViewDelegate --- UICollectionViewDataSource - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { @@ -358,7 +394,6 @@ - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - return _itemsCount; } @@ -367,155 +402,102 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell // 移除subviews 避免重用内容显示错误 [cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; - if (_sysVersion < 8) { - [self setupChildVcForCell:cell atIndexPath:indexPath]; +// NSLog(@"cellForItemAtIndexPath: current: %ld old: %ld indexpathRow: %ld \n---", (long)_currentIndex, (long)_oldIndex, (long)indexPath.item); + + [self createChildVcAtIndexPath:indexPath]; + if (_sysVersion < 8.0) { + [self collectionView:collectionView willDisplayCell:cell forItemAtIndexPath:indexPath]; } return cell; } - -- (void)setupChildVcForCell:(UICollectionViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { - if (_currentIndex != indexPath.row) { - return; // 跳过中间的多页 - } +- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath { +// NSLog(@"willDisplayCell: current: %ld old: %ld indexpathRow: %ld \n---", (long)_currentIndex, (long)_oldIndex, (long)indexPath.item); + self.indexPathWillDisplay = indexPath; - _currentChildVc = [self.childVcsDic valueForKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]]; - BOOL isFirstLoaded = _currentChildVc == nil; + UIViewController *childVc = [self createChildVcAtIndexPathIfNeeded:indexPath]; + BOOL _isCurrentVCFirstLoad = ! childVc.zj_loaded; - if (_delegate && [_delegate respondsToSelector:@selector(childViewController:forIndex:)]) { - if (_currentChildVc == nil) { - _currentChildVc = [_delegate childViewController:nil forIndex:indexPath.row]; - - if (!_currentChildVc || ![_currentChildVc conformsToProtocol:@protocol(ZJScrollPageViewChildVcDelegate)]) { - NSAssert(NO, @"子控制器必须遵守ZJScrollPageViewChildVcDelegate协议"); - } - // 设置当前下标 - _currentChildVc.zj_currentIndex = indexPath.row; - [self.childVcsDic setValue:_currentChildVc forKey:[NSString stringWithFormat:@"%ld", (long)indexPath.row]]; - } else { - [_delegate childViewController:_currentChildVc forIndex:indexPath.row]; - } - } else { - NSAssert(NO, @"必须设置代理和实现代理方法"); - } - // 这里建立子控制器和父控制器的关系 - if ([_currentChildVc isKindOfClass:[UINavigationController class]]) { - NSAssert(NO, @"不要添加UINavigationController包装后的子控制器"); - } - if (_currentChildVc.zj_scrollViewController != self.parentViewController) { - [self.parentViewController addChildViewController:_currentChildVc]; - } - _currentChildVc.view.frame = cell.contentView.bounds; - [cell.contentView addSubview:_currentChildVc.view]; - [_currentChildVc didMoveToParentViewController:self.parentViewController]; - - // NSLog(@"当前的index:%ld", indexPath.row); + [self setupChildVcForCell:cell atIndexPath:indexPath]; - if (_isLoadFirstView) { // 第一次加载cell? 不会调用endDisplayCell - [self willAppearWithIndex:indexPath.row]; - if (isFirstLoaded) { + if (_isLoadFirstView) { // 第一次加载cell, 不会调用endDisplayCell + [self willAppearWithIndex:indexPath.item]; + if (_isCurrentVCFirstLoad) { // viewDidLoad - if ([_currentChildVc respondsToSelector:@selector(zj_viewDidLoadForIndex:)]) { - [_currentChildVc zj_viewDidLoadForIndex:indexPath.row]; + if ([childVc respondsToSelector:@selector(zj_viewDidLoadForIndex:)]) { + [childVc zj_viewDidLoadForIndex:indexPath.item]; } } - [self didAppearWithIndex:indexPath.row]; - + [self didAppearWithIndex:indexPath.item]; _isLoadFirstView = NO; - } - else { - - [self willAppearWithIndex:indexPath.row]; - if (isFirstLoaded) { + } else { + if (_isCurrentVCFirstLoad && indexPath.item == _currentIndex) { // viewDidLoad - if ([_currentChildVc respondsToSelector:@selector(zj_viewDidLoadForIndex:)]) { - [_currentChildVc zj_viewDidLoadForIndex:indexPath.row]; + if ([childVc respondsToSelector:@selector(zj_viewDidLoadForIndex:)]) { + [childVc zj_viewDidLoadForIndex:indexPath.item]; + } + } + if (self.trasitionAnimated) { + if (labs(indexPath.item - _oldIndex) == 1) { + [self willDisappearWithIndex:_oldIndex]; + } + if (indexPath.item == _currentIndex) { + [self willAppearWithIndex:_currentIndex]; + } + } else { + if (indexPath.item == _currentIndex) { + [self willAppearWithIndex:_currentIndex]; + [self didAppearWithIndex:_currentIndex]; } } - [self willDisappearWithIndex:_oldIndex]; - - } - - -} - -- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath { -// NSLog(@"出现出现:current:---- %ld old ----- %ld indexpathRow----%ld ", _currentIndex, _oldIndex, indexPath.row); - if (_sysVersion >= 8) { - [self setupChildVcForCell:cell atIndexPath:indexPath]; } - } - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath { -// NSLog(@"消失消失:current:---- %ld old ----- %ld indexpathRow----%ld ", _currentIndex, _oldIndex, indexPath.row); +// NSLog(@"didEndDisplayingCell: current: %ld old: %ld indexpathRow: %ld \n---", (long)_currentIndex, (long)_oldIndex, (long)indexPath.item); - if (!self.forbidTouchToAdjustPosition) { - if (_currentIndex == indexPath.row) {// 没有滚动完成 - - - if (_needManageLifeCycle) { - UIViewController *currentVc = [self.childVcsDic valueForKey:[NSString stringWithFormat:@"%ld", _oldIndex]]; - // 开始出现 - [currentVc beginAppearanceTransition:YES animated:NO]; - - UIViewController *oldVc = [self.childVcsDic valueForKey:[NSString stringWithFormat:@"%ld", indexPath.row]]; - // 开始消失 - [oldVc beginAppearanceTransition:NO animated:NO]; - + if (self.forbidTouchToAdjustPosition) { + // 点击标题切换子页面,或者直接调用方法切换子页面 + if (self.trasitionAnimated) { + if (indexPath.item == _oldIndex) { + [self didDisappearWithIndex:_oldIndex]; } - - [self didAppearWithIndex:_oldIndex]; - [self didDisappearWithIndex:indexPath.row]; - } - else { - - - if (_oldIndex == indexPath.row) { - // 滚动完成 + if (labs(indexPath.item - _currentIndex) == 1) { [self didAppearWithIndex:_currentIndex]; - [self didDisappearWithIndex:indexPath.row]; - } - else { - // 滚动没有完成又快速的反向打开了另一页 - if (_needManageLifeCycle) { - UIViewController *currentVc = [self.childVcsDic valueForKey:[NSString stringWithFormat:@"%ld", _oldIndex]]; - // 开始出现 - [currentVc beginAppearanceTransition:YES animated:NO]; - - UIViewController *oldVc = [self.childVcsDic valueForKey:[NSString stringWithFormat:@"%ld", indexPath.row]]; - // 开始消失 - [oldVc beginAppearanceTransition:NO animated:NO]; - // 消失 - } - [self didAppearWithIndex:_oldIndex]; - [self didDisappearWithIndex:indexPath.row]; + } else { + if (indexPath.item == _oldIndex) { + [self willDisappearWithIndex:_oldIndex]; + [self didDisappearWithIndex:_oldIndex]; } - - - } - - } - else { - - if (_scrollOverOnePage) { - if (labs(_currentIndex-indexPath.row) == 1) { //滚动完成 + } else { + // 滑动切换子页面 + if (_oldIndex == indexPath.item) { // 滚动完成 +// NSLog(@"didEndDisplayingCell: 滚动完成 \n---"); + if (self.trasitionAnimated) { + [self didDisappearWithIndex:_oldIndex]; [self didAppearWithIndex:_currentIndex]; + } else { + [self willDisappearWithIndex:_oldIndex]; [self didDisappearWithIndex:_oldIndex]; } - - } - else { - [self didDisappearWithIndex:_oldIndex]; - [self didAppearWithIndex:_currentIndex]; - + } else { + if (indexPath.item == self.indexPathWillDisplay.item) { + // 滚动一半放弃了,又回到了滚动前的那一页 +// NSLog(@"didEndDisplayingCell: 滚动一半放弃了,又回到了滚动前的那一页 \n---"); + [self didDisappearWithIndex:self.oldIndex]; + [self didAppearWithIndex:indexPath.item]; + [self willDisappearWithIndex:indexPath.item]; + [self willAppearWithIndex:self.oldIndex]; + } else { +// NSLog(@"didEndDisplayingCell: 同 %@ 连续滚动 \n---", indexPath.item < self.indexPathWillDisplay.item ? @"右" : @"左"); + } + [self didDisappearWithIndex:indexPath.item]; + [self didAppearWithIndex:_oldIndex]; } - } - } #pragma mark - getter --- setter diff --git a/ZJScrollPageView/ZJTest1Controller.h b/ZJScrollPageView/ZJTest1Controller.h index 5ea3109..40a16bf 100755 --- a/ZJScrollPageView/ZJTest1Controller.h +++ b/ZJScrollPageView/ZJTest1Controller.h @@ -9,5 +9,5 @@ #import #import "ZJScrollPageViewDelegate.h" @interface ZJTest1Controller : UIViewController -@property (copy, nonatomic) void(^click)(); +@property (copy, nonatomic) void(^click)(void); @end diff --git "a/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\346\230\276\347\244\272\345\233\276\347\211\207\347\232\204\346\225\210\346\236\234/ZJVc10Controller.m" "b/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\346\230\276\347\244\272\345\233\276\347\211\207\347\232\204\346\225\210\346\236\234/ZJVc10Controller.m" index 8bbecc2..1424460 100755 --- "a/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\346\230\276\347\244\272\345\233\276\347\211\207\347\232\204\346\225\210\346\236\234/ZJVc10Controller.m" +++ "b/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\346\230\276\347\244\272\345\233\276\347\211\207\347\232\204\346\225\210\346\236\234/ZJVc10Controller.m" @@ -64,7 +64,7 @@ - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -#pragma <#arguments#> +#pragma ZJScrollPageViewChildVcDelegate - (NSInteger)numberOfChildViewControllers { return self.titles.count; } diff --git "a/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\347\274\251\346\224\276+\351\242\234\350\211\262\346\270\220\345\217\230 \346\225\210\346\236\234/ZJVc1Controller.m" "b/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\347\274\251\346\224\276+\351\242\234\350\211\262\346\270\220\345\217\230 \346\225\210\346\236\234/ZJVc1Controller.m" index 4055315..ab8c6f7 100755 --- "a/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\347\274\251\346\224\276+\351\242\234\350\211\262\346\270\220\345\217\230 \346\225\210\346\236\234/ZJVc1Controller.m" +++ "b/ZJScrollPageView/\344\275\277\347\224\250\347\244\272\344\276\213/\347\274\251\346\224\276+\351\242\234\350\211\262\346\270\220\345\217\230 \346\225\210\346\236\234/ZJVc1Controller.m" @@ -55,7 +55,7 @@ - (void)viewDidLoad { @"中国足球" ]; - ZJScrollPageView *scrollPageView = [[ZJScrollPageView alloc] initWithFrame:scrollPageViewFrame segmentStyle:style titles:_titles parentViewController:strongSelf delegate:strongSelf]; + ZJScrollPageView *scrollPageView = [[ZJScrollPageView alloc] initWithFrame:scrollPageViewFrame segmentStyle:style titles:strongSelf.titles parentViewController:strongSelf delegate:strongSelf]; strongSelf.scrollPageView = scrollPageView; // 额外的按钮响应的block @@ -82,7 +82,7 @@ - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -#pragma <#arguments#> +#pragma ZJScrollPageViewChildVcDelegate - (NSInteger)numberOfChildViewControllers { return self.titles.count; }