diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..54a6be2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Finder generated +.DS_Store + +## Vim's swap files +*.swp + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xcuserstate + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots + +#Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ diff --git a/TYPagerControllerDemo.xcodeproj/project.pbxproj b/TYPagerControllerDemo.xcodeproj/project.pbxproj index 22e9f65..137b7f1 100644 --- a/TYPagerControllerDemo.xcodeproj/project.pbxproj +++ b/TYPagerControllerDemo.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ B072EC0D1F1E37B100736A2E /* TYPagerView.m in Sources */ = {isa = PBXBuildFile; fileRef = B072EC041F1E37B100736A2E /* TYPagerView.m */; }; B072EC0E1F1E37B100736A2E /* TYPagerViewLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = B072EC061F1E37B100736A2E /* TYPagerViewLayout.m */; }; B082E5791F0E79830084C952 /* PagerViewDmeoController.m in Sources */ = {isa = PBXBuildFile; fileRef = B082E5781F0E79830084C952 /* PagerViewDmeoController.m */; }; + C24375D51F4C3F6A007A70B1 /* TestPushViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C24375D41F4C3F6A007A70B1 /* TestPushViewController.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -71,6 +72,8 @@ B072EC061F1E37B100736A2E /* TYPagerViewLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TYPagerViewLayout.m; sourceTree = ""; }; B082E5771F0E79830084C952 /* PagerViewDmeoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagerViewDmeoController.h; sourceTree = ""; }; B082E5781F0E79830084C952 /* PagerViewDmeoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PagerViewDmeoController.m; sourceTree = ""; }; + C24375D31F4C3F6A007A70B1 /* TestPushViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestPushViewController.h; sourceTree = ""; }; + C24375D41F4C3F6A007A70B1 /* TestPushViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestPushViewController.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -120,6 +123,8 @@ 2B0D5BB71F15FD1F00A4B8B1 /* CollectionViewController.m */, 2B0D5BB81F15FD1F00A4B8B1 /* CustomViewController.h */, 2B0D5BB91F15FD1F00A4B8B1 /* CustomViewController.m */, + C24375D31F4C3F6A007A70B1 /* TestPushViewController.h */, + C24375D41F4C3F6A007A70B1 /* TestPushViewController.m */, 2B0D5BBF1F15FD5100A4B8B1 /* ListViewController.h */, 2B0D5BC01F15FD5100A4B8B1 /* ListViewController.m */, 2B9C0F541F0E11E7009BC0BD /* Main.storyboard */, @@ -201,7 +206,6 @@ TargetAttributes = { 2B9C0F471F0E11E7009BC0BD = { CreatedOnToolsVersion = 8.3.3; - DevelopmentTeam = ZW52Q3KXX4; LastSwiftMigration = 0830; ProvisioningStyle = Automatic; }; @@ -248,6 +252,7 @@ 2B9C0F531F0E11E7009BC0BD /* ViewController.m in Sources */, B072EC071F1E37B100736A2E /* TYTabPagerBar.m in Sources */, B072EC0A1F1E37B100736A2E /* TYTabPagerController.m in Sources */, + C24375D51F4C3F6A007A70B1 /* TestPushViewController.m in Sources */, B072EC081F1E37B100736A2E /* TYTabPagerBarCell.m in Sources */, B0284FE11F1E595D00C733E6 /* TabPagerControllerDemoController.m in Sources */, B072EC0B1F1E37B100736A2E /* TYTabPagerView.m in Sources */, @@ -383,7 +388,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = ZW52Q3KXX4; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = TYPagerControllerDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -399,7 +404,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = ZW52Q3KXX4; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = TYPagerControllerDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/TYPagerControllerDemo/CustomViewController.m b/TYPagerControllerDemo/CustomViewController.m index 4b3656d..f963451 100644 --- a/TYPagerControllerDemo/CustomViewController.m +++ b/TYPagerControllerDemo/CustomViewController.m @@ -7,10 +7,12 @@ // #import "CustomViewController.h" +#import "TestPushViewController.h" @interface CustomViewController () @property (nonatomic, weak) UILabel *label; @property (nonatomic, weak) UIButton *cancelBtn; +@property (nonatomic, weak) UIButton *pushBtn; @end @implementation CustomViewController @@ -29,6 +31,7 @@ - (void)viewWillLayoutSubviews [super viewWillLayoutSubviews]; _label.center = CGPointMake(CGRectGetWidth(self.view.frame)/2, CGRectGetHeight(self.view.frame)/2); _cancelBtn.center = CGPointMake(_label.center.x,_label.center.y + 100); + _pushBtn.center = CGPointMake(_label.center.x,_label.center.y + 200); } - (void)addPageLabel @@ -52,6 +55,16 @@ - (void)addButton cancelBtn.center = CGPointMake(self.view.center.x, self.view.center.y + 60); [self.view addSubview:cancelBtn]; _cancelBtn = cancelBtn; + + //Push another view controller + UIButton *pushBtn = [UIButton buttonWithType:UIButtonTypeSystem]; + pushBtn.titleLabel.font = [UIFont systemFontOfSize:21]; + [pushBtn setTitle:@"push another controller" forState:UIControlStateNormal]; + [pushBtn addTarget:self action:@selector(pushAnotherController) forControlEvents:UIControlEventTouchUpInside]; + pushBtn.frame = CGRectMake(0, 0, 100, 40); + pushBtn.center = CGPointMake(self.view.center.x, self.view.center.y + 160); + [self.view addSubview:pushBtn]; + _pushBtn = pushBtn; } - (void)viewWillAppear:(BOOL)animated @@ -76,6 +89,11 @@ - (void)didReceiveMemoryWarning { // Dispose of any resources that can be recreated. } +- (void)pushAnotherController { + TestPushViewController *pushCon = [[TestPushViewController alloc] init]; + [self.navigationController pushViewController:pushCon animated:YES]; +} + /* #pragma mark - Navigation diff --git a/TYPagerControllerDemo/TYPagerController/TYPagerController.m b/TYPagerControllerDemo/TYPagerController/TYPagerController.m index 3c0f9d4..2025a72 100755 --- a/TYPagerControllerDemo/TYPagerController/TYPagerController.m +++ b/TYPagerControllerDemo/TYPagerController/TYPagerController.m @@ -54,6 +54,38 @@ - (void)viewDidLoad { [self.view addSubview:self.layout.scrollView]; } +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.visibleControllers enumerateObjectsUsingBlock: + ^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [obj beginAppearanceTransition:YES animated:animated]; + }]; +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.visibleControllers enumerateObjectsUsingBlock: + ^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [obj endAppearanceTransition]; + }]; +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + [self.visibleControllers enumerateObjectsUsingBlock: + ^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [obj beginAppearanceTransition:NO animated:animated]; + }]; +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + [self.visibleControllers enumerateObjectsUsingBlock: + ^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [obj endAppearanceTransition]; + }]; +} + - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; diff --git a/TYPagerControllerDemo/TYPagerController/TYPagerViewLayout.m b/TYPagerControllerDemo/TYPagerController/TYPagerViewLayout.m index 316e472..efc12cd 100644 --- a/TYPagerControllerDemo/TYPagerController/TYPagerViewLayout.m +++ b/TYPagerControllerDemo/TYPagerController/TYPagerViewLayout.m @@ -262,7 +262,7 @@ - (void)scrollToItemAtIndex:(NSInteger)index animate:(BOOL)animate { return; } [self scrollViewWillScrollToView:_scrollView animate:animate]; - [_scrollView setContentOffset:CGPointMake(index * CGRectGetWidth(_scrollView.frame),0) animated:NO]; + [_scrollView setContentOffset:CGPointMake(index * CGRectGetWidth(_scrollView.frame),0) animated:animate]; [self scrollViewDidScrollToView:_scrollView animate:animate]; } diff --git a/TYPagerControllerDemo/TestPushViewController.h b/TYPagerControllerDemo/TestPushViewController.h new file mode 100644 index 0000000..ab76015 --- /dev/null +++ b/TYPagerControllerDemo/TestPushViewController.h @@ -0,0 +1,13 @@ +// +// TestPushViewController.h +// TYPagerControllerDemo +// +// Created by JiangWang on 22/08/2017. +// Copyright © 2017 tany. All rights reserved. +// + +#import + +@interface TestPushViewController : UIViewController + +@end diff --git a/TYPagerControllerDemo/TestPushViewController.m b/TYPagerControllerDemo/TestPushViewController.m new file mode 100644 index 0000000..0d15f99 --- /dev/null +++ b/TYPagerControllerDemo/TestPushViewController.m @@ -0,0 +1,22 @@ +// +// TestPushViewController.m +// TYPagerControllerDemo +// +// Created by JiangWang on 22/08/2017. +// Copyright © 2017 tany. All rights reserved. +// + +#import "TestPushViewController.h" + +@interface TestPushViewController () + +@end + +@implementation TestPushViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor orangeColor]; +} + +@end