├── CoreNavVC.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── CoreNavVC.xccheckout
│ └── xcuserdata
│ │ └── Charlin.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ └── Charlin.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── CoreNavVC.xcscheme
│ └── xcschememanagement.plist
├── CoreNavVC
├── AppDelegate.h
├── AppDelegate.m
├── AppNavVC.h
├── AppNavVC.m
├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── CoreNavVC
│ ├── CoreNavVC.h
│ ├── CoreNavVC.m
│ └── Lib
│ │ ├── Category
│ │ ├── UIBarButtonItem+Appearance.h
│ │ ├── UIBarButtonItem+Appearance.m
│ │ ├── UIColor+NavExtend.h
│ │ ├── UIColor+NavExtend.m
│ │ ├── UIImage+NavColor.h
│ │ ├── UIImage+NavColor.m
│ │ ├── UINavigationController+Appearance.h
│ │ ├── UINavigationController+Appearance.m
│ │ ├── UIView+CoreNavLayout.h
│ │ └── UIView+CoreNavLayout.m
│ │ ├── CategoryProperty
│ │ └── CategoryProperty+CoreNavVC.h
│ │ ├── Controller
│ │ ├── CoreNavVC+LifeFunc.h
│ │ ├── CoreNavVC+LifeFunc.m
│ │ ├── CoreNavVC+Push_Pop.h
│ │ ├── CoreNavVC+Push_Pop.m
│ │ ├── CoreNavVC+Reachability.h
│ │ ├── CoreNavVC+Reachability.m
│ │ ├── CoreNavVC+TipView.h
│ │ ├── CoreNavVC+TipView.m
│ │ ├── UINavigationController+Plus.h
│ │ ├── UINavigationController+Plus.m
│ │ ├── UIViewController+Pop.h
│ │ ├── UIViewController+Pop.m
│ │ ├── UIViewController+scrollNavBar.h
│ │ ├── UIViewController+scrollNavBar.m
│ │ ├── VCPopView.h
│ │ ├── VCPopView.m
│ │ └── VCPopView.xib
│ │ ├── CustomPushPop
│ │ ├── Flip
│ │ │ ├── FlipAnimatedTransitioning.h
│ │ │ └── FlipAnimatedTransitioning.m
│ │ ├── Pinterest
│ │ │ ├── PinterestAnimatedTransitioning.h
│ │ │ └── PinterestAnimatedTransitioning.m
│ │ ├── Rotation
│ │ │ ├── RotationAnimatedTransitioning.h
│ │ │ └── RotationAnimatedTransitioning.m
│ │ └── ShapeLayer
│ │ │ ├── ShapeLayerAnimatedTransitioning.h
│ │ │ └── ShapeLayerAnimatedTransitioning.m
│ │ ├── FDFullscreenPopGesture
│ │ ├── UINavigationController+FDFullscreenPopGesture.h
│ │ └── UINavigationController+FDFullscreenPopGesture.m
│ │ ├── NetWork
│ │ ├── ToolNetWorkSolveVC.h
│ │ ├── ToolNetWorkSolveVC.m
│ │ ├── ToolNetWorkSolveVC.xib
│ │ ├── ToolNetWorkView.h
│ │ ├── ToolNetWorkView.m
│ │ └── ToolNetWorkView.xib
│ │ ├── Resource
│ │ └── CoreNavVC.bundle
│ │ │ ├── NextIndicator@2x.png
│ │ │ ├── gesture@2x.png
│ │ │ ├── gesture@3x.png
│ │ │ ├── prompt_wifi@2x.png
│ │ │ ├── return@2x.png
│ │ │ ├── return@3x.png
│ │ │ ├── return_hl@2x.png
│ │ │ ├── return_hl@3x.png
│ │ │ ├── roger@2x.png
│ │ │ └── roger@3x.png
│ │ └── TipView
│ │ ├── TipView.h
│ │ ├── TipView.m
│ │ └── TipView.xib
├── FooterView.h
├── FooterView.m
├── FooterView.xib
├── Framework
│ ├── CoreStatus
│ │ ├── CoreStatus.h
│ │ ├── CoreStatus.m
│ │ └── Lib
│ │ │ ├── CoreNetworkStatus.h
│ │ │ ├── CoreStatusProtocol.h
│ │ │ ├── Reachability
│ │ │ ├── Reachability.h
│ │ │ └── Reachability.m
│ │ │ └── Singleton
│ │ │ └── CoreStatusSingleton.h
│ └── CoreTransition
│ │ ├── CALayer+Transition.h
│ │ └── CALayer+Transition.m
├── HomeCell.h
├── HomeCell.m
├── HomeCell.xib
├── HomeTVC.h
├── HomeTVC.m
├── Images.xcassets
│ ├── 1.imageset
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── LaunchImage.launchimage
│ │ └── Contents.json
│ ├── logo.imageset
│ │ ├── Contents.json
│ │ └── logo.png
│ └── team.imageset
│ │ ├── Contents.json
│ │ └── team.jpg
├── Info.plist
├── PopBackVC.h
├── PopBackVC.m
├── README.md
├── RotationVC.h
├── RotationVC.m
├── RotationVC.xib
├── TopView.h
├── TopView.m
├── TopView.xib
├── ZoomScaleVC.h
├── ZoomScaleVC.m
├── ZoomScaleVC.xib
└── main.m
├── CoreNavVCTests
├── CoreNavVCTests.m
└── Info.plist
└── README.md
/CoreNavVC.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CoreNavVC.xcodeproj/project.xcworkspace/xcshareddata/CoreNavVC.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 2BDC2CCE-2C7F-4FF9-8E82-5FB816861229
9 | IDESourceControlProjectName
10 | CoreNavVC
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 143381C1CCDFD93B705A1BBFF1E033A2AFB827D7
14 | https://github.com/CharlinFeng/CoreNavVC.git
15 |
16 | IDESourceControlProjectPath
17 | CoreNavVC.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 143381C1CCDFD93B705A1BBFF1E033A2AFB827D7
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/CharlinFeng/CoreNavVC.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 143381C1CCDFD93B705A1BBFF1E033A2AFB827D7
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 143381C1CCDFD93B705A1BBFF1E033A2AFB827D7
36 | IDESourceControlWCCName
37 | CoreNavVC
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/CoreNavVC.xcodeproj/project.xcworkspace/xcuserdata/Charlin.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC.xcodeproj/project.xcworkspace/xcuserdata/Charlin.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/CoreNavVC.xcodeproj/xcuserdata/Charlin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CoreNavVC.xcodeproj/xcuserdata/Charlin.xcuserdatad/xcschemes/CoreNavVC.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 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/CoreNavVC.xcodeproj/xcuserdata/Charlin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | CoreNavVC.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 89BD6A7B1B9AEAAD00225B4B
16 |
17 | primary
18 |
19 |
20 | 89BD6A941B9AEAAD00225B4B
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/CoreNavVC/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/9/5.
6 | // Copyright (c) 2015年 冯成林. 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 |
--------------------------------------------------------------------------------
/CoreNavVC/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/9/5.
6 | // Copyright (c) 2015年 冯成林. 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 |
20 | // Override point for customization after application launch.
21 | self.window.backgroundColor = [UIColor darkGrayColor];
22 | return YES;
23 | }
24 |
25 | - (void)applicationWillResignActive:(UIApplication *)application {
26 | // 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.
27 | // 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.
28 | }
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // 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.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 | - (void)applicationWillEnterForeground:(UIApplication *)application {
36 | // 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.
37 | }
38 |
39 | - (void)applicationDidBecomeActive:(UIApplication *)application {
40 | // 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.
41 | }
42 |
43 | - (void)applicationWillTerminate:(UIApplication *)application {
44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/CoreNavVC/AppNavVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppNavVC.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/19.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC.h"
10 | #define YeahColor [UIColor colorWithRed:123.0/255. green:1 blue:1 alpha:1]
11 |
12 | @interface AppNavVC : CoreNavVC
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/CoreNavVC/AppNavVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppNavVC.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/19.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "AppNavVC.h"
10 |
11 | @interface AppNavVC ()
12 |
13 | @end
14 |
15 | @implementation AppNavVC
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | [self navBarAppearanceWithBgColor:[UIColor colorWithRed:1 green:0 blue:0 alpha:1] textColor:YeahColor titleFontPoint:18 itemFontPoint:15];
20 | // self.navigationBar.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
21 | }
22 |
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/CoreNavVC/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/CoreNavVC/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/CoreNavVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BaseNavigationComtroller.h
3 | // 通用框架
4 | //
5 | // Created by muxi on 14-9-12.
6 | // Copyright (c) 2014年 muxi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UINavigationController+Appearance.h"
11 | #import "TipView.h"
12 | #import "CoreStatus.h"
13 | #import "UINavigationController+Plus.h"
14 | #import "UIViewController+scrollNavbar.h"
15 | #import "UIBarButtonItem+Appearance.h"
16 | #import "UIViewController+Pop.h"
17 | #import "RotationAnimatedTransitioning.h"
18 | #import "PinterestAnimatedTransitioning.h"
19 | #import "ShapeLayerAnimatedTransitioning.h"
20 | #import "FlipAnimatedTransitioning.h"
21 |
22 | typedef enum{
23 |
24 | NavTypeNone = 0,
25 | NavTypePush,
26 | NavTypePop
27 |
28 | } NavType;
29 |
30 | @interface CoreNavVC : UINavigationController
31 |
32 | @property (nonatomic,strong) TipView *tipView;
33 |
34 | @property (nonatomic,strong) NSArray *hideNetworkBarControllerArray; //此数组内的控制器(名)不会显示无网络提示框
35 |
36 | @property (nonatomic,weak) UIView *navBgView;
37 |
38 | @property (nonatomic,assign) BOOL isShowedTipViewProperty;
39 |
40 | @property (nonatomic,strong) Reachability *readchability;
41 |
42 | @property (nonatomic,strong) NSArray *hideNetworkBarControllerArrayFull; //这个是最终的读取数组
43 |
44 | @property (nonatomic,assign) NavType navType;
45 |
46 | @property (nonatomic,strong) RotationAnimatedTransitioning *at;
47 | @property (nonatomic,strong) PinterestAnimatedTransitioning *pt;
48 | @property (nonatomic,strong) ShapeLayerAnimatedTransitioning *st;
49 | @property (nonatomic,strong) FlipAnimatedTransitioning *ft;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/CoreNavVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // BaseNavigationComtroller.m
3 | // 通用框架
4 | //
5 | // Created by muxi on 14-9-12.
6 | // Copyright (c) 2014年 muxi. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC.h"
10 | #import "ToolNetWorkSolveVC.h"
11 | #import "CoreNavVC+TipView.h"
12 | #import "CoreNavVC+Reachability.h"
13 | #import "CoreNavVC+LifeFunc.h"
14 | #import "CoreNavVC+Push_Pop.h"
15 | #import "UIView+CoreNavLayout.h"
16 |
17 | @interface CoreNavVC ()
18 |
19 |
20 | @end
21 |
22 | @implementation CoreNavVC
23 |
24 |
25 | -(TipView *)tipView{
26 |
27 | if(_tipView == nil){
28 |
29 | _tipView = [TipView tipView];
30 |
31 | // UIView *bgView = nil;
32 | //
33 | // if([UIDevice currentDevice].systemVersion.floatValue >=16.0){
34 | //
35 | // UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
36 | // bgView = blurView;
37 | //
38 | // }else{
39 | //
40 | // UIToolbar *toolBar = [[UIToolbar alloc] init];
41 | // toolBar.barStyle = UIBarStyleBlack;
42 | // bgView = toolBar;
43 | // }
44 | // [bgView addGestureRecognizer:[[UIPanGestureRecognizer alloc] init]];
45 | // [_tipView insertSubview:bgView atIndex:0];
46 |
47 | // [bgView layout_InSuperView_edgeinsetsZero];
48 |
49 | _tipView.alpha = 0;
50 | }
51 | return _tipView;
52 | }
53 |
54 |
55 |
56 | -(NSArray *)hideNetworkBarControllerArrayFull{
57 |
58 | if(!_hideNetworkBarControllerArrayFull){
59 | NSMutableArray *arrayM=[NSMutableArray arrayWithArray:self.hideNetworkBarControllerArray];
60 | [arrayM addObject:NSStringFromClass([ToolNetWorkSolveVC class])];
61 | _hideNetworkBarControllerArrayFull=[arrayM copy];
62 | }
63 | return _hideNetworkBarControllerArrayFull;
64 | }
65 |
66 | -(RotationAnimatedTransitioning *)at{
67 |
68 | if(_at == nil){
69 |
70 | _at = [[RotationAnimatedTransitioning alloc] init];
71 | _at.navVC = self;
72 | }
73 |
74 | return _at;
75 | }
76 |
77 | -(PinterestAnimatedTransitioning *)pt{
78 |
79 | if(_pt == nil){
80 |
81 | _pt = [[PinterestAnimatedTransitioning alloc] init];
82 | _pt.navVC = self;
83 | }
84 |
85 | return _pt;
86 | }
87 |
88 | -(ShapeLayerAnimatedTransitioning *)st{
89 |
90 | if(_st == nil){
91 |
92 | _st = [[ShapeLayerAnimatedTransitioning alloc] init];
93 | _st.navVC = self;
94 | }
95 |
96 | return _st;
97 | }
98 |
99 | -(FlipAnimatedTransitioning *)ft{
100 |
101 | if(_ft == nil){
102 |
103 | _ft = [[FlipAnimatedTransitioning alloc] init];
104 | _ft.navVC = self;
105 | }
106 |
107 | return _ft;
108 | }
109 |
110 | @end
111 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIBarButtonItem+Appearance.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIBarButtonItem+Appearance.h
3 | // Drivers
4 | //
5 | // Created by muxi on 15/2/5.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 |
13 | @interface UIBarButtonItem (Appearance)
14 |
15 | + (UIBarButtonItem *)customItemWithTarget:(id)target action:(SEL)action image:(NSString *)image highImage:(NSString *)highImage;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIBarButtonItem+Appearance.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIBarButtonItem+Appearance.m
3 | // Drivers
4 | //
5 | // Created by muxi on 15/2/5.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import "UIBarButtonItem+Appearance.h"
10 |
11 | @implementation UIBarButtonItem (Appearance)
12 |
13 | /**
14 | * 创建一个item
15 | *
16 | * @param target 点击item后调用哪个对象的方法
17 | * @param action 点击item后调用target的哪个方法
18 | * @param image 图片
19 | * @param highImage 高亮的图片
20 | *
21 | * @return 创建完的item
22 | */
23 | + (UIBarButtonItem *)customItemWithTarget:(id)target action:(SEL)action image:(NSString *)image highImage:(NSString *)highImage
24 | {
25 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
26 | [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
27 | // 设置图片
28 | [btn setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
29 | [btn setBackgroundImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
30 | // 设置尺寸
31 | btn.frame = (CGRect){CGPointZero,btn.currentBackgroundImage.size};
32 | return [[UIBarButtonItem alloc] initWithCustomView:btn];
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIColor+NavExtend.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+Extend.h
3 | // Wifi
4 | //
5 | // Created by muxi on 14/11/19.
6 | // Copyright (c) 2014年 muxi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface UIColor (NavExtend)
13 |
14 |
15 |
16 |
17 | /**
18 | * 十六进制颜色
19 | */
20 | + (UIColor *)colorWithHexColorString:(NSString *)hexColorString;
21 |
22 |
23 |
24 |
25 |
26 |
27 | /**
28 | * 十六进制颜色:含alpha
29 | */
30 | + (UIColor *)colorWithHexColorString:(NSString *)hexColorString alpha:(float)alpha;
31 |
32 |
33 |
34 |
35 |
36 |
37 | @end
38 |
39 |
40 |
41 |
42 |
43 | /** 普通定义 */
44 | #define rgb(r,g,b) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1.0f]
45 | #define rgba(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
46 | #define hexColor(colorV) [UIColor colorWithHexColorString:@#colorV]
47 | #define hexColorAlpha(colorV,a) [UIColor colorWithHexColorString:@#colorV alpha:a];
48 |
49 | /** 随机色 */
50 | #define RamdomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0f green:arc4random_uniform(256)/255.0f blue:arc4random_uniform(256)/255.0f alpha:1.0f]
51 |
52 | /** 常用颜色 */
53 | #define PNGrey [UIColor colorWithRed:246.0 / 255.0 green:246.0 / 255.0 blue:246.0 / 255.0 alpha:1.0f]
54 | #define PNLightBlue [UIColor colorWithRed:94.0 / 255.0 green:147.0 / 255.0 blue:196.0 / 255.0 alpha:1.0f]
55 | #define PNGreen [UIColor colorWithRed:77.0 / 255.0 green:186.0 / 255.0 blue:122.0 / 255.0 alpha:1.0f]
56 | #define PNTitleColor [UIColor colorWithRed:0.0 / 255.0 green:189.0 / 255.0 blue:113.0 / 255.0 alpha:1.0f]
57 | #define PNButtonGrey [UIColor colorWithRed:141.0 / 255.0 green:141.0 / 255.0 blue:141.0 / 255.0 alpha:1.0f]
58 | #define PNLightGreen [UIColor colorWithRed:77.0 / 255.0 green:216.0 / 255.0 blue:122.0 / 255.0 alpha:1.0f]
59 | #define PNFreshGreen [UIColor colorWithRed:77.0 / 255.0 green:196.0 / 255.0 blue:122.0 / 255.0 alpha:1.0f]
60 | #define PNDeepGreen [UIColor colorWithRed:77.0 / 255.0 green:176.0 / 255.0 blue:122.0 / 255.0 alpha:1.0f]
61 | #define PNRed [UIColor colorWithRed:245.0 / 255.0 green:94.0 / 255.0 blue:78.0 / 255.0 alpha:1.0f]
62 | #define PNMauve [UIColor colorWithRed:88.0 / 255.0 green:75.0 / 255.0 blue:103.0 / 255.0 alpha:1.0f]
63 | #define PNBrown [UIColor colorWithRed:119.0 / 255.0 green:107.0 / 255.0 blue:95.0 / 255.0 alpha:1.0f]
64 | #define PNBlue [UIColor colorWithRed:82.0 / 255.0 green:116.0 / 255.0 blue:188.0 / 255.0 alpha:1.0f]
65 | #define PNDarkBlue [UIColor colorWithRed:121.0 / 255.0 green:134.0 / 255.0 blue:142.0 / 255.0 alpha:1.0f]
66 | #define PNYellow [UIColor colorWithRed:242.0 / 255.0 green:197.0 / 255.0 blue:117.0 / 255.0 alpha:1.0f]
67 | #define PNWhite [UIColor colorWithRed:255.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:1.0f]
68 | #define PNDeepGrey [UIColor colorWithRed:99.0 / 255.0 green:99.0 / 255.0 blue:99.0 / 255.0 alpha:1.0f]
69 | #define PNPinkGrey [UIColor colorWithRed:200.0 / 255.0 green:193.0 / 255.0 blue:193.0 / 255.0 alpha:1.0f]
70 | #define PNHealYellow [UIColor colorWithRed:245.0 / 255.0 green:242.0 / 255.0 blue:238.0 / 255.0 alpha:1.0f]
71 | #define PNLightGrey [UIColor colorWithRed:225.0 / 255.0 green:225.0 / 255.0 blue:225.0 / 255.0 alpha:1.0f]
72 | #define PNCleanGrey [UIColor colorWithRed:251.0 / 255.0 green:251.0 / 255.0 blue:251.0 / 255.0 alpha:1.0f]
73 | #define PNLightYellow [UIColor colorWithRed:241.0 / 255.0 green:240.0 / 255.0 blue:240.0 / 255.0 alpha:1.0f]
74 | #define PNDarkYellow [UIColor colorWithRed:152.0 / 255.0 green:150.0 / 255.0 blue:159.0 / 255.0 alpha:1.0f]
75 | #define PNPinkDark [UIColor colorWithRed:170.0 / 255.0 green:165.0 / 255.0 blue:165.0 / 255.0 alpha:1.0f]
76 | #define PNCloudWhite [UIColor colorWithRed:244.0 / 255.0 green:244.0 / 255.0 blue:244.0 / 255.0 alpha:1.0f]
77 | #define PNBlack [UIColor colorWithRed:45.0 / 255.0 green:45.0 / 255.0 blue:45.0 / 255.0 alpha:1.0f]
78 | #define PNStarYellow [UIColor colorWithRed:252.0 / 255.0 green:223.0 / 255.0 blue:101.0 / 255.0 alpha:1.0f]
79 | #define PNTwitterColor [UIColor colorWithRed:0.0 / 255.0 green:171.0 / 255.0 blue:243.0 / 255.0 alpha:1.0]
80 | #define PNWeiboColor [UIColor colorWithRed:250.0 / 255.0 green:0.0 / 255.0 blue:33.0 / 255.0 alpha:1.0]
81 | #define PNiOSGreenColor [UIColor colorWithRed:98.0 / 255.0 green:247.0 / 255.0 blue:77.0 / 255.0 alpha:1.0]
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIColor+NavExtend.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+Extend.m
3 | // Wifi
4 | //
5 | // Created by muxi on 14/11/19.
6 | // Copyright (c) 2014年 muxi. All rights reserved.
7 | //
8 |
9 | #import "UIColor+NavExtend.h"
10 |
11 | @implementation UIColor (NavExtend)
12 |
13 |
14 |
15 | #pragma mark 十六进制颜色
16 | + (UIColor *)colorWithHexColorString:(NSString *)hexColorString{
17 | return [self colorWithHexColorString:hexColorString alpha:1.0f];
18 | }
19 |
20 |
21 |
22 |
23 | #pragma mark 十六进制颜色
24 | + (UIColor *)colorWithHexColorString:(NSString *)hexColorString alpha:(float)alpha{
25 |
26 | unsigned int red, green, blue;
27 |
28 | NSRange range;
29 |
30 | range.length =2;
31 |
32 | range.location =0;
33 |
34 | [[NSScanner scannerWithString:[hexColorString substringWithRange:range]]scanHexInt:&red];
35 |
36 | range.location =2;
37 |
38 | [[NSScanner scannerWithString:[hexColorString substringWithRange:range]]scanHexInt:&green];
39 |
40 | range.location =4;
41 |
42 | [[NSScanner scannerWithString:[hexColorString substringWithRange:range]]scanHexInt:&blue];
43 |
44 | UIColor *color = [UIColor colorWithRed:(float)(red/255.0f)green:(float)(green/255.0f)blue:(float)(blue/255.0f)alpha:alpha];
45 |
46 | return color;
47 | }
48 |
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIImage+NavColor.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+Color.h
3 | // 网易彩票2014MJ版
4 | //
5 | // Created by 沐汐 on 14-9-13.
6 | // Copyright (c) 2014年 沐汐. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UIColor+NavExtend.h"
11 |
12 | @interface UIImage (NavColor)
13 |
14 | //给我一种颜色,一个尺寸,我给你返回一个UIImage:不透明
15 | +(UIImage *)imageFromContextWithColor:(UIColor *)color;
16 | +(UIImage *)imageFromContextWithColor:(UIColor *)color size:(CGSize)size;
17 |
18 |
19 |
20 |
21 | - (UIImage *) imageWithTintColor:(UIColor *)tintColor;
22 | - (UIImage *) imageWithGradientTintColor:(UIColor *)tintColor;
23 |
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIImage+NavColor.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+Color.m
3 | // 网易彩票2014MJ版
4 | //
5 | // Created by 沐汐 on 14-9-13.
6 | // Copyright (c) 2014年 沐汐. All rights reserved.
7 | //
8 |
9 | #import "UIImage+NavColor.h"
10 |
11 | @implementation UIImage (NavColor)
12 |
13 |
14 | //给我一种颜色,一个尺寸,我给你返回一个UIImage
15 | +(UIImage *)imageFromContextWithColor:(UIColor *)color size:(CGSize)size{
16 |
17 | CGRect rect=(CGRect){{0.0f,0.0f},size};
18 |
19 | //开启一个图形上下文
20 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0f);
21 |
22 | //获取图形上下文
23 | CGContextRef context=UIGraphicsGetCurrentContext();
24 |
25 | CGContextSetFillColorWithColor(context, color.CGColor);
26 |
27 | CGContextFillRect(context, rect);
28 |
29 | //获取图像
30 | UIImage *image=UIGraphicsGetImageFromCurrentImageContext();
31 |
32 | //关闭上下文
33 | UIGraphicsEndImageContext();
34 |
35 | return image;
36 | }
37 |
38 | +(UIImage *)imageFromContextWithColor:(UIColor *)color{
39 |
40 | CGSize size=CGSizeMake(1.0f, 1.0f);
41 |
42 | return [self imageFromContextWithColor:color size:size];
43 | }
44 |
45 |
46 | - (UIImage *) imageWithTintColor:(UIColor *)tintColor
47 | {
48 | return [self imageWithTintColor:tintColor blendMode:kCGBlendModeDestinationIn];
49 | }
50 |
51 | - (UIImage *) imageWithGradientTintColor:(UIColor *)tintColor
52 | {
53 | return [self imageWithTintColor:tintColor blendMode:kCGBlendModeOverlay];
54 | }
55 |
56 | - (UIImage *) imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode
57 | {
58 | //We want to keep alpha, set opaque to NO; Use 0.0f for scale to use the scale factor of the device’s main screen.
59 | UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
60 | [tintColor setFill];
61 | CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
62 | UIRectFill(bounds);
63 |
64 | //Draw the tinted image in context
65 | [self drawInRect:bounds blendMode:blendMode alpha:1.0f];
66 |
67 | if (blendMode != kCGBlendModeDestinationIn) {
68 | [self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];
69 | }
70 |
71 | UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
72 | UIGraphicsEndImageContext();
73 |
74 | return tintedImage;
75 | }
76 |
77 |
78 | @end
79 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UINavigationController+Appearance.h:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+Appearance.h
3 | // Drivers
4 | //
5 | // Created by muxi on 15/2/5.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UINavigationController (Appearance)
12 | -(void)navBarAppearanceWithBgColor:(UIColor *)bgColor textColor:(UIColor *)textColor titleFontPoint:(CGFloat)titleFontPoint itemFontPoint:(CGFloat)itemFontPoint;
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UINavigationController+Appearance.m:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+Appearance.m
3 | // Drivers
4 | //
5 | // Created by muxi on 15/2/5.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import "UINavigationController+Appearance.h"
10 | #import "UIImage+NavColor.h"
11 |
12 | #define ios6x [[[UIDevice currentDevice] systemVersion] floatValue] < 7.0f
13 | #define rgba(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
14 |
15 | @implementation UINavigationController (Appearance)
16 |
17 |
18 | -(void)navBarAppearanceWithBgColor:(UIColor *)bgColor textColor:(UIColor *)textColor titleFontPoint:(CGFloat)titleFontPoint itemFontPoint:(CGFloat)itemFontPoint{
19 |
20 | if(textColor==nil) textColor=[UIColor blackColor];
21 |
22 | //取出navbar条的全局外观
23 | UINavigationBar *navbarAppearance=[UINavigationBar appearance];
24 |
25 | //navbar设置背景图片:
26 | //BarMetrics:横竖屏模式
27 | if(bgColor != nil) [navbarAppearance setBackgroundImage:[UIImage imageFromContextWithColor:bgColor] forBarMetrics:UIBarMetricsDefault];
28 |
29 | //navbar设置标题文字样式:
30 | //字体:
31 | UIFont *font=ios6x?[UIFont systemFontOfSize:titleFontPoint]:[UIFont boldSystemFontOfSize:titleFontPoint];
32 | NSShadow *shadow=[[NSShadow alloc] init];
33 | shadow.shadowColor=[UIColor clearColor];
34 | [navbarAppearance setTitleTextAttributes:@{
35 | NSFontAttributeName: font, //标题文字字体
36 | NSForegroundColorAttributeName:textColor, //标题文字颜色
37 | NSShadowAttributeName:shadow, //标题文字阴影颜色
38 | }];
39 |
40 |
41 | //UIBarButtonItem设置:
42 | //取出navbaritem的全部外观
43 | UIBarButtonItem *navBarItem = [UIBarButtonItem appearance];
44 |
45 | //item的字体大小
46 | UIFont *itemFont=[UIFont systemFontOfSize:itemFontPoint];
47 |
48 | //设置文字外观:正常
49 | [navBarItem setTitleTextAttributes:@{
50 | NSForegroundColorAttributeName: textColor, // 文字颜色
51 | NSShadowAttributeName:shadow, //阴影颜色
52 | NSFontAttributeName:itemFont //字体大小
53 | } forState:UIControlStateNormal];
54 | //高亮
55 | [navBarItem setTitleTextAttributes:@{
56 | NSForegroundColorAttributeName: rgba(181, 181, 181,1.0f), // 文字颜色
57 | NSShadowAttributeName:shadow, //阴影颜色
58 | NSFontAttributeName:itemFont //字体大小
59 | } forState:UIControlStateHighlighted];
60 |
61 | //设置文字背景图片
62 | [navBarItem setBackgroundImage:[UIImage imageFromContextWithColor:[UIColor clearColor]] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
63 |
64 | //设置返回文字及图标颜色
65 | navbarAppearance.tintColor=textColor;
66 | }
67 |
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIView+CoreNavLayout.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+CoreNavLayout.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/1/14.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIView (CoreNavLayout)
12 |
13 | -(void)layout_InSuperView_edgeinsetsZero;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Category/UIView+CoreNavLayout.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+CoreNavLayout.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/1/14.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "UIView+CoreNavLayout.h"
10 |
11 | @implementation UIView (CoreNavLayout)
12 |
13 | -(void)layout_InSuperView_edgeinsetsZero{
14 |
15 | UIView *superView = self.superview;
16 |
17 | if (superView == nil) return;
18 |
19 | self.translatesAutoresizingMaskIntoConstraints=NO;
20 |
21 | NSDictionary *views = @{@"v":self};
22 |
23 | NSArray *c_H=[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[v]-0-|" options:0 metrics:nil views:views];
24 | NSArray *c_V=[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[v]-0-|" options:0 metrics:nil views:views];
25 | [superView addConstraints:c_H];
26 | [superView addConstraints:c_V];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CategoryProperty/CategoryProperty+CoreNavVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // CategoryProperty+CoreNavVC.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/1/2.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #ifndef CategoryProperty_CoreNavVC_h
10 | #define CategoryProperty_CoreNavVC_h
11 |
12 | #import
13 |
14 | #define ADD_DYNAMIC_PROPERTY(PROPERTY_TYPE,PROPERTY_NAME,SETTER_NAME) \
15 | \
16 | @dynamic PROPERTY_NAME ; \
17 | \
18 | static char kProperty##PROPERTY_NAME; \
19 | \
20 | - ( PROPERTY_TYPE ) PROPERTY_NAME \
21 | \
22 | { \
23 | \
24 | return ( PROPERTY_TYPE ) objc_getAssociatedObject(self, &(kProperty##PROPERTY_NAME ) ); \
25 | \
26 | } \
27 | \
28 | - (void) SETTER_NAME :( PROPERTY_TYPE ) PROPERTY_NAME \
29 | \
30 | { \
31 | \
32 | objc_setAssociatedObject(self, &kProperty##PROPERTY_NAME , PROPERTY_NAME , OBJC_ASSOCIATION_RETAIN); \
33 | }
34 |
35 |
36 |
37 | #define ADD_DYNAMIC_PROPERTY_CGFloat(PROPERTY_TYPE,PROPERTY_NAME,SETTER_NAME) \
38 | \
39 | static char kProperty##PROPERTY_NAME; \
40 | \
41 | - (PROPERTY_TYPE) PROPERTY_NAME \
42 | \
43 | { \
44 | \
45 | return [objc_getAssociatedObject(self, &(kProperty##PROPERTY_NAME) ) floatValue]; \
46 | \
47 | } \
48 | \
49 | - (void) SETTER_NAME :( PROPERTY_TYPE ) PROPERTY_NAME \
50 | \
51 | { \
52 | \
53 | objc_setAssociatedObject(self, &kProperty##PROPERTY_NAME , @(PROPERTY_NAME) , OBJC_ASSOCIATION_RETAIN); \
54 | }
55 |
56 |
57 | #endif
58 |
59 | /* CategoryProperty_CoreNavVC_h */
60 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+LifeFunc.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+LifeFunc.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC.h"
10 |
11 | @interface CoreNavVC (LifeFunc)
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+LifeFunc.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+LifeFunc.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC+LifeFunc.h"
10 | #import "CoreNavVC+Reachability.h"
11 | #import "CoreNavVC+TipView.h"
12 | #import "CoreNavVC+Push_Pop.h"
13 |
14 |
15 | @implementation CoreNavVC (LifeFunc)
16 |
17 |
18 |
19 | -(void)viewDidLoad{
20 |
21 | [super viewDidLoad];
22 |
23 | //监听网络状态
24 | [self beginReachabilityNoti];
25 |
26 | //背景
27 | self.view.backgroundColor=[UIColor clearColor];
28 |
29 | /** 处理tipView */
30 | [self handleTipView];
31 |
32 | [self netWorkStatusChange];
33 |
34 | [self customPushPopPrepare];
35 | }
36 |
37 |
38 | -(void)viewDidAppear:(BOOL)animated{
39 |
40 | [super viewDidAppear:animated];
41 |
42 | if(self.navBgView != nil) return;
43 | [self findBgView];
44 | }
45 |
46 |
47 | #pragma mark 屏幕旋转
48 | -(UIInterfaceOrientationMask)supportedInterfaceOrientations{
49 | return self.topViewController.supportedInterfaceOrientations;
50 | }
51 |
52 | -(void)findBgView{
53 | return;
54 | UIView *bgView = nil;
55 |
56 | for (UIView *subView in self.navigationBar.subviews) {
57 |
58 | if ([subView isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]) {
59 |
60 | // [subView removeFromSuperview];
61 | bgView = subView;bgView.backgroundColor = [UIColor clearColor];
62 | }
63 | }
64 |
65 | //
66 | // for (UIView *subView in self.navigationBar.subviews) {
67 | //
68 | // if ([subView isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]) {
69 | //
70 | // [subView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
71 | // NSLog(@"%@",obj);
72 | // }];
73 | //
74 | // }
75 | // }
76 |
77 | self.navBgView = bgView;
78 | }
79 |
80 | -(void)dealloc{
81 |
82 | [[NSNotificationCenter defaultCenter] removeObserver:self];
83 | }
84 |
85 | -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
86 | [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
87 |
88 | [self netWorkStatusChange];
89 | }
90 |
91 | -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
92 | [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
93 |
94 | [self netWorkStatusChange];
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+Push_Pop.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+Push_Pop.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC.h"
10 | #import "UIBarButtonItem+Appearance.h"
11 |
12 | @interface CoreNavVC (Push_Pop)
13 |
14 | -(void)customPushPopPrepare;
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+Push_Pop.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+Push_Pop.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC+Push_Pop.h"
10 | #import "CoreNavVC+Reachability.h"
11 | #import "CoreNavVC+TipView.h"
12 | #import "UIViewController+Pop.h"
13 | #import "RotationAnimatedTransitioning.h"
14 |
15 |
16 | @interface CoreNavVC ()
17 |
18 | @end
19 |
20 |
21 | @implementation CoreNavVC (Push_Pop)
22 |
23 |
24 | -(void)customPushPopPrepare{
25 |
26 | self.delegate = self;
27 | }
28 |
29 |
30 | /** 自定义转场动画 */
31 | - (id)navigationController:(UINavigationController *)navigationController
32 | animationControllerForOperation:(UINavigationControllerOperation)operation
33 | fromViewController:(UIViewController *)fromVC
34 | toViewController:(UIViewController *)toVC
35 | {
36 |
37 | if(
38 |
39 | [fromVC conformsToProtocol:@protocol(RotationAnimatedTransitioningProtocol)]
40 | &&
41 | [toVC conformsToProtocol:@protocol(RotationAnimatedTransitioningProtocol)]
42 |
43 | ){
44 |
45 | return self.at;
46 |
47 | }else if(
48 |
49 | [fromVC conformsToProtocol:@protocol(PinterestAnimatedTransitioningProtocol)]
50 | &&
51 | [toVC conformsToProtocol:@protocol(PinterestAnimatedTransitioningProtocol)]
52 |
53 | ){
54 |
55 | return self.pt;
56 |
57 | }else if(
58 |
59 | [fromVC conformsToProtocol:@protocol(ShapeLayerAnimatedTransitioningProtocol)]
60 | &&
61 | [toVC conformsToProtocol:@protocol(ShapeLayerAnimatedTransitioningProtocol)]
62 |
63 | ){
64 |
65 | return self.st;
66 | }else if(
67 |
68 | [fromVC conformsToProtocol:@protocol(FlipAnimatedTransitioningProtocol)]
69 | &&
70 | [toVC conformsToProtocol:@protocol(FlipAnimatedTransitioningProtocol)]
71 |
72 | ){
73 |
74 | return self.ft;
75 | }
76 |
77 | return nil;
78 | }
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | -(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
99 |
100 | NSLog(@"pushViewController");
101 |
102 | self.navType = NavTypePush;
103 |
104 | if(self.viewControllers.count >= 1){
105 | viewController.navigationItem.leftBarButtonItem=[UIBarButtonItem customItemWithTarget:self action:@selector(popAction) image:@"CoreNavVC.bundle/return" highImage:@"CoreNavVC.bundle/return_hl"];
106 |
107 | viewController.hidesBottomBarWhenPushed = YES;
108 | }
109 |
110 | [super pushViewController:viewController animated:animated];
111 |
112 | if (self.viewControllers.count > 1) {
113 |
114 | [self checkShowedTipView];
115 | }
116 | }
117 |
118 |
119 | -(UIViewController *)popViewControllerAnimated:(BOOL)animated{
120 |
121 | NSLog(@"popViewControllerAnimated");
122 |
123 | [[NSNotificationCenter defaultCenter] postNotificationName:@"NavigationControllerWillPopNoti" object:self];
124 |
125 | self.navType = NavTypePop;
126 |
127 | UIViewController *vc = [super popViewControllerAnimated:animated];
128 |
129 | //再次检查当前控制器是否需要显示网络状态提示视图
130 | [self netWorkStatusChange];
131 |
132 | if (self.viewControllers.count >= 1){
133 | self.hidesBottomBarWhenPushed = YES;
134 | }
135 |
136 | return vc;
137 | }
138 |
139 | -(void)popAction{
140 |
141 | __weak UIViewController *vc = self.topViewController;
142 |
143 | if(vc.popActionKeeper.PopAction != nil){vc.popActionKeeper.PopAction();return;}
144 |
145 | if(self.topViewController.disablePopFunction) return;
146 | [self popViewControllerAnimated:YES];
147 | }
148 |
149 |
150 | @end
151 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+Reachability.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+Reachability.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC.h"
10 |
11 | @interface CoreNavVC (Reachability)
12 |
13 | #pragma mark 监听网络状态
14 | -(void)beginReachabilityNoti;
15 |
16 | /** 网络状态变更 */
17 | -(void)netWorkStatusChange;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+Reachability.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+Reachability.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC+Reachability.h"
10 | #import "CoreStatus.h"
11 | #import "ToolNetWorkView.h"
12 | #import "ToolNetWorkSolveVC.h"
13 |
14 | @implementation CoreNavVC (Reachability)
15 |
16 | #pragma mark 监听网络状态
17 | -(void)beginReachabilityNoti{
18 |
19 | Reachability *readchability=[Reachability reachabilityForInternetConnection];
20 |
21 | //记录
22 | self.readchability=readchability;
23 |
24 | //开始通知
25 | [readchability startNotifier];
26 |
27 | //监听通知
28 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netWorkStatusChange) name:kReachabilityChangedNotification object:readchability];
29 |
30 | }
31 |
32 |
33 | /** 网络状态变更 */
34 | -(void)netWorkStatusChange{
35 |
36 | if([self needHideNetWorkBarWithVC:self.topViewController]){
37 |
38 | //这里dismiss的原因在于可能由其他页面pop回来的时候,如果直接return会导致bar显示出来。
39 | [self dismissNetWorkBar];
40 | return;
41 | }
42 |
43 | if([CoreStatus isNetworkEnable]){
44 |
45 | [self dismissNetWorkBar];
46 |
47 | }else{
48 |
49 | [self showNetWorkBar];
50 | }
51 | }
52 |
53 | #pragma mark 显示网络状态提示条
54 | -(void)showNetWorkBar{
55 |
56 | CGFloat y = self.navigationBar.frame.size.height + 20.0f;
57 |
58 | [ToolNetWorkView showNetWordNotiInViewController:self y:y];
59 | }
60 |
61 | #pragma mark 隐藏网络状态提示条
62 | -(void)dismissNetWorkBar{
63 | [ToolNetWorkView dismissNetWordNotiInViewController:self];
64 | }
65 |
66 |
67 |
68 | -(BOOL)needHideNetWorkBarWithVC:(UIViewController *)vc{
69 | NSString *vcStr=NSStringFromClass(vc.class);
70 | BOOL res = [self.hideNetworkBarControllerArrayFull containsObject:vcStr];
71 |
72 | return res;
73 | }
74 |
75 |
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+TipView.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+TipView.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC.h"
10 |
11 | @interface CoreNavVC (TipView)
12 |
13 | /** 处理tipView */
14 | -(void)handleTipView;
15 |
16 | /** 检查是否显示过了tipView */
17 | -(void)checkShowedTipView;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/CoreNavVC+TipView.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVC+TipView.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CoreNavVC+TipView.h"
10 |
11 | @implementation CoreNavVC (TipView)
12 |
13 |
14 |
15 | /** 处理tipView */
16 | -(void)handleTipView{
17 |
18 | __weak typeof(self) weakSelf=self;
19 |
20 | self.tipView.ClickDismissBtnBlock = ^{
21 |
22 | [UIView animateWithDuration:0.5 animations:^{
23 |
24 | weakSelf.tipView.alpha = 0;
25 |
26 | } completion:^(BOOL finished) {
27 |
28 | [weakSelf.tipView removeFromSuperview];
29 |
30 | weakSelf.tipView = nil;
31 | }];
32 | };
33 | }
34 |
35 |
36 | /** 检查是否显示过了tipView */
37 | -(void)checkShowedTipView{
38 |
39 | if (!self.isShowedTipViewProperty) {
40 |
41 | static NSString *const tipViewKey = @"TipViewKey";
42 |
43 | BOOL isShowed = [[NSUserDefaults standardUserDefaults] boolForKey:tipViewKey];
44 |
45 | [self.view addSubview:self.tipView];
46 |
47 | self.tipView.translatesAutoresizingMaskIntoConstraints=NO;
48 |
49 | NSDictionary *views = @{@"tipView":self.tipView};
50 |
51 | NSArray *c_H=[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[tipView]-0-|" options:0 metrics:nil views:views];
52 | NSArray *c_V=[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[tipView]-0-|" options:0 metrics:nil views:views];
53 | [self.view addConstraints:c_H];
54 | [self.view addConstraints:c_V];
55 | // isShowed = NO;
56 | if(!isShowed){
57 |
58 | [self.view endEditing:YES];
59 |
60 | [UIView animateWithDuration:0.8 animations:^{
61 | self.tipView.alpha = 1;
62 | }];
63 |
64 | //保存key
65 | [[NSUserDefaults standardUserDefaults] setBool:YES forKey:tipViewKey];
66 |
67 | self.isShowedTipViewProperty = YES;
68 | }
69 | }
70 | }
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/UINavigationController+Plus.h:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+Plus.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UINavigationController (Plus)
12 |
13 | /** 隐藏导航条 */
14 | -(void)hideNavBarWithAnim:(BOOL)anim;
15 |
16 | /** 显示导航条 */
17 | -(void)showNavBarWithAnim:(BOOL)anim;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/UINavigationController+Plus.m:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+Plus.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "UINavigationController+Plus.h"
10 | #import "CoreNavVC.h"
11 |
12 | @implementation UINavigationController (Plus)
13 |
14 | /** 隐藏导航条 */
15 | -(void)hideNavBarWithAnim:(BOOL)anim{
16 |
17 | CoreNavVC *navVC = (CoreNavVC *)self;
18 | navVC.navBgView.alpha = 1;
19 | [self setNavigationBarHidden:YES animated:anim];
20 | }
21 |
22 | /** 显示导航条 */
23 | -(void)showNavBarWithAnim:(BOOL)anim{
24 | CoreNavVC *navVC = (CoreNavVC *)self;
25 | navVC.navBgView.alpha = 1;
26 | [self setNavigationBarHidden:NO animated:anim];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/UIViewController+Pop.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+Pop.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/1/14.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "VCPopView.h"
11 |
12 | @interface PopActionKeeper : NSObject
13 |
14 | @property (nonatomic,copy) void(^PopAction)();
15 |
16 | @end
17 |
18 | @interface UIViewController (Pop)
19 |
20 | @property (nonatomic,weak) VCPopView *popView;
21 |
22 | @property (nonatomic,assign) BOOL disablePopFunction;
23 |
24 | @property (nonatomic,copy) void(^PopAction)();
25 |
26 | /** 模型内部使用对象 */
27 | @property (nonatomic,strong) PopActionKeeper *popActionKeeper;
28 |
29 | /** 添加pop返回功能 */
30 | -(void)addPopFunctionWithAnim:(BOOL)anim;
31 |
32 | -(void)popGestureEnable:(BOOL)enable;
33 |
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/UIViewController+Pop.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+Pop.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/1/14.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "UIViewController+Pop.h"
10 | #import "CategoryProperty+CoreNavVC.h"
11 | #import "UINavigationController+FDFullscreenPopGesture.h"
12 |
13 |
14 | @implementation PopActionKeeper
15 |
16 |
17 |
18 | @end
19 |
20 |
21 |
22 | @implementation UIViewController (Pop)
23 |
24 | ADD_DYNAMIC_PROPERTY(PopActionKeeper *, popActionKeeper, setPopActionKeeper)
25 |
26 |
27 | /** 添加pop返回功能 */
28 | -(void)addPopFunctionWithAnim:(BOOL)anim{
29 |
30 | if(self.popView != nil) return;
31 | NSLog(@"---------------");
32 | //创建一个PopView
33 | VCPopView *popView = [VCPopView popView];
34 |
35 | CGFloat wh = 35;
36 | CGFloat x = 4.5;
37 | CGFloat y = 23.8;
38 | if([UIScreen mainScreen].bounds.size.width > 375) {x = 8; y = 24.5;};
39 | popView.frame = CGRectMake(x, y, wh, wh);
40 |
41 | popView.layer.cornerRadius = wh / 2;
42 | popView.layer.masksToBounds = YES;
43 |
44 | [self.view addSubview:popView];
45 |
46 | if(anim){
47 |
48 | popView.alpha=0;
49 |
50 | [UIView animateWithDuration:0.25 animations:^{
51 | popView.alpha = 1;
52 | }];
53 | }
54 |
55 | __weak typeof(self) weakSelf=self;
56 |
57 | popView.PopActioinBlock = self.popActionKeeper.PopAction != nil ? self.PopAction : ^{
58 |
59 | if(!self.disablePopFunction){
60 | [weakSelf.navigationController popViewControllerAnimated:YES];
61 | }
62 | };
63 |
64 | self.popView = popView;
65 | }
66 |
67 |
68 |
69 |
70 |
71 | -(void)popGestureEnable:(BOOL)enable{
72 |
73 | self.fd_interactivePopDisabled = !enable;
74 | }
75 |
76 |
77 |
78 |
79 |
80 |
81 | static const char CoreNavCanPopKey = '\0';
82 |
83 | -(void)setDisablePopFunction:(BOOL)disablePopFunction{
84 |
85 | if(disablePopFunction != self.disablePopFunction){
86 |
87 | [self willChangeValueForKey:@"CoreNavCanPopKey"]; // KVO
88 |
89 | objc_setAssociatedObject(self, &CoreNavCanPopKey,
90 | @(disablePopFunction), OBJC_ASSOCIATION_ASSIGN);
91 | [self didChangeValueForKey:@"CoreNavCanPopKey"]; // KVO
92 | }
93 | }
94 |
95 | -(BOOL)disablePopFunction{
96 | return [objc_getAssociatedObject(self, &CoreNavCanPopKey) boolValue];
97 | }
98 |
99 | static const char PopViewKey = '\0';
100 |
101 | -(void)setPopView:(VCPopView *)popView{
102 |
103 | if(popView != self.popView){
104 |
105 | [self willChangeValueForKey:@"PopViewKey"]; // KVO
106 |
107 | objc_setAssociatedObject(self, &PopViewKey,
108 | popView, OBJC_ASSOCIATION_ASSIGN);
109 | [self didChangeValueForKey:@"PopViewKey"]; // KVO
110 | }
111 | }
112 |
113 | -(VCPopView *)popView{
114 | return objc_getAssociatedObject(self, &PopViewKey);
115 | }
116 |
117 | -(void)setPopAction:(void (^)())PopAction{
118 |
119 |
120 | if(self.popActionKeeper == nil){
121 |
122 | self.popActionKeeper = [PopActionKeeper new];
123 | }
124 |
125 | self.popActionKeeper.PopAction = PopAction;
126 |
127 | }
128 |
129 |
130 | -(void (^)())PopAction{
131 |
132 | return self.popActionKeeper.PopAction;
133 | }
134 |
135 |
136 |
137 |
138 | @end
139 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/UIViewController+scrollNavBar.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+scrollMeau.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "VCPopView.h"
11 |
12 | @interface UIViewController (scrollNavbar)
13 |
14 | @property (nonatomic,strong) UIView *nav_topView;
15 |
16 | @property (nonatomic,assign) BOOL enableParallax;
17 |
18 | @property (nonatomic,assign) BOOL isViewDidAppear;
19 |
20 | @property (nonatomic,assign) CGFloat offsetYP,parallaxValue;
21 |
22 | /** 添加滚动效果: 创建的topview不需要指定frame,内部算 */
23 | -(void)addScrollNavbarWithScrollView:(UIScrollView *)scrollView autoToggleNavbarHeight:(CGFloat)autoToggleNavbarHeight originHeight:(CGFloat)originHeight;
24 |
25 | /** 移除滚动效果 */
26 | -(void)removeScrollNavbarWithScrollView:(UIScrollView *)scrollView;
27 |
28 | -(void)viewWillAppear_scrollNavbar;
29 |
30 | -(void)viewWillDisappear_scrollNavbar;
31 |
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/UIViewController+scrollNavBar.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+scrollMeau.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "UIViewController+scrollNavbar.h"
10 | #import "CoreNavVC.h"
11 | #import "CategoryProperty+CoreNavVC.h"
12 | #import "UIView+CoreNavLayout.h"
13 |
14 | @interface UIViewController (scrollNavbar)
15 |
16 | @property (nonatomic,strong) NSNumber *topViewOriginHeight, *autoToggleNavbarHeight;
17 |
18 | @property (nonatomic,strong) UIView *nav_topContentView;
19 |
20 |
21 |
22 | @end
23 |
24 |
25 | static NSString const *ScrollViewKeyPath_CoreNavVC = @"contentOffset";
26 |
27 | @implementation UIViewController (scrollNavbar)
28 |
29 | ADD_DYNAMIC_PROPERTY(NSNumber *, topViewOriginHeight, setTopViewOriginHeight)
30 | ADD_DYNAMIC_PROPERTY(NSNumber *, autoToggleNavbarHeight, setAutoToggleNavbarHeight)
31 | ADD_DYNAMIC_PROPERTY(UIView *, nav_topContentView, setNav_topContentView)
32 |
33 | ADD_DYNAMIC_PROPERTY_CGFloat(CGFloat, offsetYP, setOffsetYP)
34 | ADD_DYNAMIC_PROPERTY_CGFloat(CGFloat, parallaxValue, setParallaxValue)
35 |
36 |
37 |
38 | -(void)viewWillAppear_scrollNavbar{
39 |
40 | self.isViewDidAppear = YES;
41 |
42 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.6 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
43 |
44 | [self addPopFunctionWithAnim:YES];
45 | });
46 |
47 | if (self.offsetYP <= 0){self.navigationController.navigationBar.alpha=0;return;}
48 | if (self.offsetYP >= 1){self.navigationController.navigationBar.alpha=1;return;}
49 |
50 | [UIView animateWithDuration:0.25 animations:^{
51 | self.navigationController.navigationBar.alpha = 0;
52 | }];
53 |
54 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
55 |
56 | [UIView animateWithDuration:0.25 animations:^{
57 | self.navigationController.navigationBar.alpha = self.offsetYP;
58 | }];
59 | });
60 | }
61 |
62 |
63 |
64 | -(void)viewWillDisappear_scrollNavbar{
65 |
66 | self.isViewDidAppear = NO;
67 |
68 | [UIView animateWithDuration:0.25 animations:^{
69 |
70 | self.navigationController.navigationBar.alpha = 1;
71 | }];
72 | }
73 |
74 |
75 |
76 | static const char CoreNavTopViewKey = '\0';
77 | -(void)setNav_topView:(UIView *)nav_topView{
78 |
79 | if(nav_topView != self.nav_topView){
80 |
81 | [self willChangeValueForKey:@"CoreNavTopViewKey"]; // KVO
82 |
83 | objc_setAssociatedObject(self, &CoreNavTopViewKey,
84 | nav_topView, OBJC_ASSOCIATION_ASSIGN);
85 | [self didChangeValueForKey:@"CoreNavTopViewKey"]; // KVO
86 | }
87 | }
88 |
89 | -(UIView *)nav_topView{
90 | return objc_getAssociatedObject(self, &CoreNavTopViewKey);
91 | }
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | /** 添加滚动效果: 创建的topview不需要指定frame,内部算 */
102 | -(void)addScrollNavbarWithScrollView:(UIScrollView *)scrollView autoToggleNavbarHeight:(CGFloat)autoToggleNavbarHeight originHeight:(CGFloat)originHeight{
103 |
104 | NSAssert(self.nav_topView != nil, @"[Charlin Feng]: nav_topView must have value!");
105 |
106 | self.automaticallyAdjustsScrollViewInsets = NO;
107 | self.extendedLayoutIncludesOpaqueBars = YES;
108 | self.autoToggleNavbarHeight = @(autoToggleNavbarHeight);
109 | self.topViewOriginHeight = @(originHeight);
110 |
111 |
112 | //初始化frame
113 | self.nav_topContentView = [[UIView alloc] initWithFrame:CGRectMake(0, -originHeight, [UIScreen mainScreen].bounds.size.width, originHeight)];
114 |
115 | //嵌套
116 | [self.nav_topContentView addSubview:self.nav_topView];
117 |
118 | //添加约束
119 | [self.nav_topView layout_InSuperView_edgeinsetsZero];
120 |
121 | scrollView.contentInset = UIEdgeInsetsMake(originHeight, 0, 0, 0);
122 | [scrollView insertSubview:self.nav_topContentView atIndex:0];
123 | [scrollView addObserver:self forKeyPath:ScrollViewKeyPath_CoreNavVC options:NSKeyValueObservingOptionNew context:nil];
124 | }
125 |
126 |
127 | /** 移除滚动效果 */
128 | -(void)removeScrollNavbarWithScrollView:(UIScrollView *)scrollView{
129 |
130 | CoreNavVC *navVC = (CoreNavVC *)self.navigationController;
131 | [navVC showNavBarWithAnim:YES];
132 | [scrollView removeObserver:self forKeyPath:ScrollViewKeyPath_CoreNavVC];
133 | [scrollView removeFromSuperview];
134 | scrollView = nil;
135 | }
136 |
137 |
138 | -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
139 |
140 | if(!self.isViewDidAppear) {return;}
141 |
142 | if (self.nav_topView == nil) {return;}
143 |
144 | UIScrollView *scrollView = (UIScrollView *)object;
145 |
146 | if(scrollView == nil){return;}
147 |
148 | CGFloat offsetY = scrollView.contentOffset.y;
149 |
150 | CGFloat maxOffsetY = 250;
151 |
152 | CGFloat realOffset = offsetY + self.topViewOriginHeight.floatValue;
153 |
154 |
155 |
156 | CGFloat p = realOffset / maxOffsetY;
157 |
158 | self.offsetYP = p;
159 |
160 | CoreNavVC *navVC = (CoreNavVC *)self.navigationController;
161 |
162 | navVC.navigationBar.alpha = p;
163 | self.popView.hidden = NO;
164 |
165 | self.popView.hidden = p > 0.5;
166 |
167 | if (realOffset > maxOffsetY) {return;}
168 |
169 | CGFloat parallaxValue_temp = self.parallaxValue;
170 | if (parallaxValue_temp == 0) {parallaxValue_temp = 120;}
171 |
172 | if(offsetY > -self.topViewOriginHeight.floatValue) {
173 |
174 | if(self.enableParallax){
175 | CGRect frame = self.nav_topContentView.frame;
176 | frame.origin.y = offsetY - p * parallaxValue_temp;
177 | self.nav_topContentView.frame = frame;
178 | }
179 |
180 | }else {
181 |
182 | CGRect frame = self.nav_topContentView.frame;
183 | CGFloat height = - offsetY;
184 | frame.size.height = height;
185 | frame.origin.y = -height;
186 | self.nav_topContentView.frame = frame;
187 | }
188 |
189 | }
190 |
191 |
192 |
193 |
194 | static const char CoreNavEnableParallax = '\0';
195 |
196 | -(void)setEnableParallax:(BOOL)enableParallax{
197 |
198 | if(enableParallax != self.enableParallax){
199 |
200 | [self willChangeValueForKey:@"CoreNavEnableParallax"]; // KVO
201 |
202 | objc_setAssociatedObject(self, &CoreNavEnableParallax,
203 | @(enableParallax), OBJC_ASSOCIATION_ASSIGN);
204 | [self didChangeValueForKey:@"CoreNavEnableParallax"]; // KVO
205 | }
206 | }
207 |
208 | -(BOOL)enableParallax{
209 | return [objc_getAssociatedObject(self, &CoreNavEnableParallax) boolValue];
210 | }
211 |
212 |
213 |
214 |
215 | static const char CoreNavIsViewDidAppear = '\0';
216 |
217 | -(void)setIsViewDidAppear:(BOOL)isViewDidAppear{
218 |
219 | if(isViewDidAppear != self.isViewDidAppear){
220 |
221 | [self willChangeValueForKey:@"CoreNavIsViewDidAppear"]; // KVO
222 |
223 | objc_setAssociatedObject(self, &CoreNavIsViewDidAppear,
224 | @(isViewDidAppear), OBJC_ASSOCIATION_ASSIGN);
225 | [self didChangeValueForKey:@"CoreNavIsViewDidAppear"]; // KVO
226 | }
227 | }
228 |
229 | -(BOOL)isViewDidAppear{
230 | return [objc_getAssociatedObject(self, &CoreNavIsViewDidAppear) boolValue];
231 | }
232 |
233 | @end
234 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/VCPopView.h:
--------------------------------------------------------------------------------
1 | //
2 | // VCPopView.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface VCPopView : UIView
12 |
13 | @property (nonatomic,copy) void (^PopActioinBlock)();
14 |
15 | +(instancetype)popView;
16 |
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/VCPopView.m:
--------------------------------------------------------------------------------
1 | //
2 | // VCPopView.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/12/23.
6 | // Copyright © 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "VCPopView.h"
10 | #import "UIView+CoreNavLayout.h"
11 |
12 |
13 | @implementation VCPopView
14 |
15 |
16 | +(instancetype)popView{
17 |
18 | return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil].firstObject;
19 | }
20 |
21 | - (IBAction)btnClickAction:(id)sender {
22 | if (self.PopActioinBlock != nil) self.PopActioinBlock();
23 | }
24 |
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Controller/VCPopView.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/Flip/FlipAnimatedTransitioning.h:
--------------------------------------------------------------------------------
1 | //
2 | // PinterestAnimatedTransitioning.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 |
13 | @protocol FlipAnimatedTransitioningProtocol
14 |
15 |
16 | @end
17 |
18 |
19 | @interface FlipAnimatedTransitioning : NSObject
20 |
21 | @property (nonatomic,weak) UINavigationController *navVC;
22 |
23 | @end
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/Flip/FlipAnimatedTransitioning.m:
--------------------------------------------------------------------------------
1 | //
2 | // FlipAnimatedTransitioning.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "FlipAnimatedTransitioning.h"
10 | #import "CoreNavVC.h"
11 |
12 | @interface FlipAnimatedTransitioning ()
13 |
14 | @property (nonatomic,strong) UIView *v1,*v2;
15 |
16 | @end
17 |
18 | @implementation FlipAnimatedTransitioning
19 |
20 | -(NSTimeInterval)transitionDuration:(id)transitionContext{
21 |
22 | return 0.5;
23 | }
24 |
25 | -(void)animateTransition:(id)transitionContext{
26 |
27 | CoreNavVC *navVC = (CoreNavVC *)self.navVC;
28 |
29 | UIView *containerView = [transitionContext containerView];
30 |
31 | UIViewController * fromVc = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
32 | UIViewController * toVc = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
33 | CGRect finalFrameForVc = [transitionContext finalFrameForViewController:toVc];
34 | CGFloat finalWidth = finalFrameForVc.size.width;
35 | CGFloat finalHeight = finalFrameForVc.size.height;
36 |
37 | fromVc.view.frame = finalFrameForVc;
38 | toVc.view.frame = finalFrameForVc;
39 |
40 | BOOL isPush = navVC.navType == NavTypePush;
41 | BOOL isVerti = (isPush ? fromVc : toVc).view.tag == 0;
42 |
43 | __weak UIView *animView = nil;
44 |
45 | CGFloat item1_x = finalFrameForVc.origin.x;
46 | CGFloat item1_y = finalFrameForVc.origin.y;
47 | CGFloat item1_w = isVerti ? finalWidth : finalWidth * 0.5f;
48 | CGFloat item1_h = isVerti ? finalHeight * 0.5f : finalHeight;
49 | CGRect item1Frame = CGRectMake(item1_x, item1_y, item1_w, item1_h);
50 |
51 | CGAffineTransform transform_Item1_from = CGAffineTransformIdentity;
52 | CGAffineTransform transform_Item1_to = CGAffineTransformIdentity;
53 | CGAffineTransform transform_Item2_from = CGAffineTransformIdentity;
54 | CGAffineTransform transform_Item2_to = CGAffineTransformIdentity;
55 |
56 | if(isPush){
57 |
58 |
59 | [containerView addSubview:fromVc.view];
60 | [containerView addSubview:toVc.view];
61 |
62 | animView = fromVc.view;
63 | transform_Item1_from = CGAffineTransformIdentity;
64 | transform_Item1_to = isVerti ? CGAffineTransformMakeTranslation(0, -item1_h) : CGAffineTransformMakeTranslation(-item1_w, 0);
65 | transform_Item2_from = CGAffineTransformIdentity;
66 | transform_Item2_to = isVerti ? CGAffineTransformMakeTranslation(0, item1_h) : CGAffineTransformMakeTranslation(item1_w, 0);
67 |
68 | }else{
69 |
70 | [containerView addSubview:toVc.view];
71 | [containerView addSubview:fromVc.view];
72 |
73 | animView = toVc.view;
74 |
75 | transform_Item1_from = isVerti ? CGAffineTransformMakeTranslation(0, -item1_h) : CGAffineTransformMakeTranslation(-item1_w, 0);
76 | transform_Item1_to = CGAffineTransformIdentity;
77 | transform_Item2_from = isVerti ? CGAffineTransformMakeTranslation(0, item1_h) : CGAffineTransformMakeTranslation(item1_w, 0);
78 | transform_Item2_to = CGAffineTransformIdentity;
79 | }
80 |
81 | //先做上下切割
82 |
83 | if(isPush){
84 | UIView *item1ItemView = [animView resizableSnapshotViewFromRect:item1Frame afterScreenUpdates:NO withCapInsets:UIEdgeInsetsZero];
85 | item1ItemView.frame = item1Frame;
86 | self.v1 = item1ItemView;
87 | }
88 | [containerView addSubview:self.v1];
89 |
90 | if(isPush){
91 | CGRect item2Frame = isVerti ? CGRectMake(item1_x, item1_h, item1_w, item1_h) : CGRectMake(item1_w, item1_y, item1_w, item1_h);
92 | UIView *item2ItemView = [animView resizableSnapshotViewFromRect:item2Frame afterScreenUpdates:NO withCapInsets:UIEdgeInsetsZero];
93 | item2ItemView.frame = item2Frame;
94 | self.v2 = item2ItemView;
95 | }
96 |
97 | [containerView addSubview:self.v2];
98 |
99 | //执行动画
100 | NSTimeInterval duratioin = [self transitionDuration:nil];
101 | self.v1.transform = transform_Item1_from;
102 | self.v2.transform = transform_Item2_from;
103 | [UIView animateWithDuration:duratioin animations:^{
104 | [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
105 | self.v1.transform = transform_Item1_to;
106 | self.v2.transform = transform_Item2_to;
107 | } completion:^(BOOL finished) {
108 | self.v1.transform = CGAffineTransformIdentity;
109 | self.v2.transform = CGAffineTransformIdentity;
110 | [self.v1 removeFromSuperview];
111 | [self.v2 removeFromSuperview];
112 | [transitionContext completeTransition:YES];
113 | }];
114 | // [UIView animateWithDuration:duratioin delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:0.8 options:UIViewAnimationOptionCurveEaseOut animations:^{
115 | //
116 | // item1ItemView.transform = transform_Item1_to;
117 | // item2ItemView.transform = transform_Item2_to;
118 | //
119 | // } completion:^(BOOL finished) {
120 | //
121 | // item1ItemView.transform = CGAffineTransformIdentity;
122 | // item2ItemView.transform = CGAffineTransformIdentity;
123 | // [item1ItemView removeFromSuperview];
124 | // [item2ItemView removeFromSuperview];
125 | // [transitionContext completeTransition:YES];
126 | // }];
127 | }
128 |
129 | @end
130 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/Pinterest/PinterestAnimatedTransitioning.h:
--------------------------------------------------------------------------------
1 | //
2 | // PinterestAnimatedTransitioning.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 |
13 | @protocol PinterestAnimatedTransitioningProtocol
14 |
15 | @required
16 | -(UIView *)PinterestAnimatedTransitioningProtocol_PinterestView;
17 | -(CGRect)PinterestAnimatedTransitioningProtocol_DestinationConvertToWindowFrame;
18 |
19 | @end
20 |
21 |
22 | @interface PinterestAnimatedTransitioning : NSObject
23 |
24 | @property (nonatomic,weak) UINavigationController *navVC;
25 |
26 | @end
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/Pinterest/PinterestAnimatedTransitioning.m:
--------------------------------------------------------------------------------
1 | //
2 | // PinterestAnimatedTransitioning.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "PinterestAnimatedTransitioning.h"
10 | #import "CoreNavVC.h"
11 |
12 | @implementation PinterestAnimatedTransitioning
13 |
14 | -(NSTimeInterval)transitionDuration:(id)transitionContext{
15 |
16 | return 1;
17 | }
18 |
19 | -(void)animateTransition:(id)transitionContext{
20 |
21 | CoreNavVC *navVC = (CoreNavVC *)self.navVC;
22 |
23 | UIView *containerView = [transitionContext containerView];
24 |
25 | UIViewController * fromVc = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
26 | UIViewController * toVc = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
27 | CGRect finalFrameForVc = [transitionContext finalFrameForViewController:toVc];
28 |
29 | fromVc.view.frame = finalFrameForVc;
30 | toVc.view.frame = finalFrameForVc;
31 |
32 | BOOL isPush = navVC.navType == NavTypePush;
33 |
34 |
35 | if(isPush){
36 |
37 |
38 | [containerView addSubview:fromVc.view];
39 | [containerView addSubview:toVc.view];
40 |
41 |
42 |
43 | }else{
44 |
45 | [[transitionContext containerView] addSubview:toVc.view];
46 | // [[transitionContext containerView] addSubview:fromVc.view];
47 | }
48 |
49 | //起点view
50 | UIView *startView = [fromVc PinterestAnimatedTransitioningProtocol_PinterestView];
51 | //终点view
52 | UIView *endView = [toVc PinterestAnimatedTransitioningProtocol_PinterestView];
53 |
54 | UIImageView *sourceImageView_temp = nil;
55 |
56 |
57 | if([startView isKindOfClass:[UIImageView class]]){
58 |
59 | UIImageView *imageView_Source = (UIImageView *)startView;
60 |
61 | sourceImageView_temp = [[UIImageView alloc] init];
62 |
63 | //设置frame
64 | sourceImageView_temp.frame = [startView convertRect:startView.bounds toView:nil];
65 |
66 | //设置image
67 | sourceImageView_temp.image = imageView_Source.image;
68 |
69 | //统一配置
70 | sourceImageView_temp.contentMode = imageView_Source.contentMode;
71 | sourceImageView_temp.backgroundColor = imageView_Source.backgroundColor;
72 |
73 | }else{
74 |
75 |
76 | sourceImageView_temp = nil;
77 | }
78 |
79 | //添加
80 | [containerView addSubview:sourceImageView_temp];
81 |
82 | //准备开始动画
83 | //目标frame
84 | CGRect destinationFrame = CGRectZero;
85 |
86 | if(isPush){
87 |
88 | destinationFrame = [toVc PinterestAnimatedTransitioningProtocol_DestinationConvertToWindowFrame];
89 |
90 | }else{
91 |
92 | destinationFrame = [endView convertRect:endView.bounds toView:nil];
93 | }
94 |
95 | //开始动画
96 | //隐藏原视图
97 | startView.hidden = YES;
98 | endView.hidden = YES;
99 | toVc.view.alpha = 0;
100 |
101 | NSTimeInterval duration = [self transitionDuration:nil];
102 |
103 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:0.2 options:UIViewAnimationOptionCurveEaseInOut animations:^{
104 |
105 | sourceImageView_temp.frame = destinationFrame;
106 | toVc.view.alpha = 1;
107 |
108 | } completion:^(BOOL finished) {
109 |
110 | startView.hidden = NO;
111 | endView.hidden = NO;
112 | [sourceImageView_temp removeFromSuperview];
113 | [transitionContext completeTransition:YES];
114 | }];
115 |
116 | }
117 |
118 |
119 |
120 | @end
121 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/Rotation/RotationAnimatedTransitioning.h:
--------------------------------------------------------------------------------
1 | //
2 | // RotationAnimatedTransitioning.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @protocol RotationAnimatedTransitioningProtocol
13 |
14 | @optional
15 | -(CGPoint)RotationAnimatedTransitioningProtocol_anchorPoint;
16 | -(BOOL)RotationAnimatedTransitioningProtocol_isClockWise;
17 |
18 | @end
19 |
20 |
21 | @interface RotationAnimatedTransitioning : NSObject
22 |
23 | @property (nonatomic,weak) UINavigationController *navVC;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/Rotation/RotationAnimatedTransitioning.m:
--------------------------------------------------------------------------------
1 | //
2 | // RotationAnimatedTransitioning.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "RotationAnimatedTransitioning.h"
10 | #import "CoreNavVC.h"
11 |
12 |
13 | @implementation RotationAnimatedTransitioning
14 |
15 |
16 |
17 | -(NSTimeInterval)transitionDuration:(id)transitionContext{
18 |
19 | return 1;
20 | }
21 |
22 | -(void)animateTransition:(id)transitionContext{
23 |
24 | CoreNavVC *navVC = (CoreNavVC *)self.navVC;
25 |
26 | UIViewController *fromVc = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
27 | UIViewController *toVc = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
28 |
29 |
30 | CGRect finalFrameForVc = [transitionContext finalFrameForViewController:toVc];
31 |
32 | fromVc.view.frame = finalFrameForVc;
33 | toVc.view.frame = finalFrameForVc;
34 |
35 | BOOL isPush = navVC.navType == NavTypePush;
36 |
37 |
38 |
39 | if(isPush){
40 |
41 | [[transitionContext containerView] addSubview:fromVc.view];
42 | [[transitionContext containerView] addSubview:toVc.view];
43 |
44 |
45 | }else{
46 | [[transitionContext containerView] addSubview:toVc.view];
47 | [[transitionContext containerView] addSubview:fromVc.view];
48 | }
49 |
50 |
51 | CGPoint anchorPoint = CGPointZero;
52 | CGFloat isClockWise = NO;
53 | if([fromVc respondsToSelector:@selector(RotationAnimatedTransitioningProtocol_anchorPoint)]){
54 |
55 | anchorPoint = [fromVc RotationAnimatedTransitioningProtocol_anchorPoint];
56 | }
57 |
58 | if([fromVc respondsToSelector:@selector(RotationAnimatedTransitioningProtocol_isClockWise)]){
59 |
60 | isClockWise = [fromVc RotationAnimatedTransitioningProtocol_isClockWise];
61 | }
62 |
63 | UIView *animView = isPush ? toVc.view : fromVc.view;
64 |
65 | [self animWithView:animView anchorPoint:anchorPoint isClockWise:isClockWise isPush:isPush completeAction:^{
66 |
67 | [transitionContext completeTransition:YES];
68 | }];
69 | }
70 |
71 | -(void)animWithView:(UIView *)animView anchorPoint:(CGPoint)anchorPoint isClockWise:(BOOL)isClockWise isPush:(BOOL)isPush completeAction:(void(^)())completeAction{
72 |
73 | animView.layer.anchorPoint = anchorPoint;
74 | CGRect bounds = [[UIScreen mainScreen] bounds];
75 | animView.layer.position = CGPointMake(bounds.size.width * anchorPoint.x, bounds.size.height * anchorPoint.y);
76 |
77 | NSInteger i = isClockWise ? -1 : 1;
78 |
79 | CGAffineTransform tranform_begin = isPush ? CGAffineTransformMakeRotation(M_PI_4 * 2 * i) : CGAffineTransformIdentity;
80 |
81 | CGAffineTransform tranform_end = isPush ? CGAffineTransformIdentity : CGAffineTransformMakeRotation(M_PI_2 * i);
82 |
83 | animView.transform = tranform_begin;
84 |
85 | NSTimeInterval duration = [self transitionDuration:nil];
86 |
87 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{
88 | animView.transform = tranform_end;
89 | } completion:^(BOOL finished) {
90 | if(completeAction != nil) completeAction();
91 | if(isPush) return;
92 | [animView removeFromSuperview];
93 | }];
94 |
95 | }
96 |
97 |
98 |
99 |
100 | @end
101 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/ShapeLayer/ShapeLayerAnimatedTransitioning.h:
--------------------------------------------------------------------------------
1 | //
2 | // PinterestAnimatedTransitioning.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 |
13 | @protocol ShapeLayerAnimatedTransitioningProtocol
14 |
15 | @optional
16 | -(UIView *)ShapeLayerAnimatedTransitioningProtocol_SouceView;
17 | -(CGFloat)ShapeLayerAnimatedTransitioningProtocol_MaxRadius_p;
18 | -(void)ShapeLayerAnimatedTransitioningProtocol_WillPop;
19 | -(void)ShapeLayerAnimatedTransitioningProtocol_DidPop;
20 |
21 | @end
22 |
23 |
24 | @interface ShapeLayerAnimatedTransitioning : NSObject
25 |
26 | @property (nonatomic,weak) UINavigationController *navVC;
27 |
28 | @end
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/CustomPushPop/ShapeLayer/ShapeLayerAnimatedTransitioning.m:
--------------------------------------------------------------------------------
1 | //
2 | // ShapeLayerAnimatedTransitioning.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/2/11.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "ShapeLayerAnimatedTransitioning.h"
10 | #import "CoreNavVC.h"
11 |
12 |
13 | @interface ShapeLayerAnimatedTransitioning ()
14 |
15 | @property (nonatomic,strong) id transitionContext;
16 |
17 | @property (nonatomic,strong) UIView *blurView;
18 |
19 | @end
20 |
21 | @implementation ShapeLayerAnimatedTransitioning
22 |
23 | -(NSTimeInterval)transitionDuration:(id)transitionContext{
24 |
25 | return 0.32;
26 | }
27 |
28 | -(void)animateTransition:(id)transitionContext{
29 |
30 | //记录
31 | self.transitionContext = transitionContext;
32 |
33 | CoreNavVC *navVC = (CoreNavVC *)self.navVC;
34 |
35 | BOOL isPush = navVC.navType == NavTypePush;
36 |
37 | UIView *containerView = [transitionContext containerView];
38 |
39 | UIViewController * fromVc = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
40 | UIViewController * toVc = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
41 | CGRect finalFrameForVc = [transitionContext finalFrameForViewController:toVc];
42 |
43 |
44 | fromVc.view.frame = finalFrameForVc;
45 | toVc.view.frame = finalFrameForVc;
46 | self.blurView.frame = finalFrameForVc;
47 |
48 |
49 | //转化frame
50 | CGRect sourceView_Frame = CGRectZero;
51 |
52 | UIBezierPath *fromPath = nil;
53 | UIBezierPath *toPath = nil;
54 |
55 | //获取sourceView
56 | __weak UIView *sourceView = nil;
57 | __weak UIView *animView = nil;
58 | __weak UIView *otherView = nil;
59 |
60 | CGFloat alpha_from = 0;
61 | CGFloat alpha_to = 0;
62 | CGFloat alpha_blur_from = 0;
63 | CGFloat alpha_blur_to = 0;
64 | CGAffineTransform tranfrom_from = CGAffineTransformIdentity;
65 | CGAffineTransform tranfrom_to = CGAffineTransformIdentity;
66 |
67 | CGSize screenSize = [UIScreen mainScreen].bounds.size;
68 | CGFloat screenW = screenSize.width;
69 | CGFloat screenH = screenSize.height;
70 |
71 | CGFloat p = 1;
72 | if(isPush){
73 |
74 | if([fromVc respondsToSelector:@selector(ShapeLayerAnimatedTransitioningProtocol_MaxRadius_p)]){
75 |
76 | p = [fromVc ShapeLayerAnimatedTransitioningProtocol_MaxRadius_p];
77 | }
78 | }
79 |
80 | CGFloat maxRadius = sqrtf(screenW * screenW + screenH * screenH) * p;
81 |
82 |
83 | if(isPush){
84 |
85 | [containerView addSubview:fromVc.view];
86 | [containerView addSubview:self.blurView];
87 | [containerView addSubview:toVc.view];
88 |
89 | sourceView = [fromVc ShapeLayerAnimatedTransitioningProtocol_SouceView];
90 | sourceView_Frame = [sourceView convertRect:sourceView.bounds toView:nil];
91 |
92 | animView = toVc.view;
93 | otherView = fromVc.view;
94 |
95 | alpha_from = 1;
96 | alpha_to = 0.8;
97 | alpha_blur_from = 0;
98 | alpha_blur_to = 1;
99 | tranfrom_from = CGAffineTransformIdentity;
100 | tranfrom_to = CGAffineTransformMakeScale(4, 4);
101 |
102 |
103 | if(sourceView.layer.cornerRadius == 0){
104 |
105 | fromPath = [UIBezierPath bezierPathWithRect:sourceView_Frame];
106 |
107 | toPath = [UIBezierPath bezierPathWithRect:[UIScreen mainScreen].bounds];
108 |
109 | }else{
110 |
111 | CGFloat wh = sourceView_Frame.size.width;
112 |
113 | CGFloat centerX = sourceView_Frame.origin.x + wh * 0.5;
114 | CGFloat centerY = sourceView_Frame.origin.y + wh * 0.5;
115 | CGPoint center = CGPointMake(centerX, centerY);
116 |
117 | fromPath = [UIBezierPath bezierPathWithArcCenter:center radius:wh*0.5 startAngle:0 endAngle:M_PI * 2 clockwise:YES];
118 | toPath = [UIBezierPath bezierPathWithArcCenter:center radius:maxRadius startAngle:0 endAngle:M_PI * 2 clockwise:YES];
119 | }
120 |
121 |
122 | }else{
123 |
124 | sourceView = [toVc ShapeLayerAnimatedTransitioningProtocol_SouceView];
125 | sourceView_Frame = [sourceView convertRect:sourceView.frame toView:nil];
126 | [[transitionContext containerView] addSubview:toVc.view];
127 | [containerView addSubview:self.blurView];
128 | [[transitionContext containerView] addSubview:fromVc.view];
129 |
130 | animView = fromVc.view;
131 | otherView = toVc.view;
132 |
133 | alpha_from = 0.8;
134 | alpha_to = 1;
135 | alpha_blur_from = 1;
136 | alpha_blur_to = 0;
137 |
138 | tranfrom_from = CGAffineTransformMakeScale(4, 4);
139 | tranfrom_to = CGAffineTransformIdentity;
140 |
141 | if(sourceView.layer.cornerRadius == 0){
142 |
143 | fromPath = [UIBezierPath bezierPathWithRect:[UIScreen mainScreen].bounds];
144 | toPath = [UIBezierPath bezierPathWithRect:sourceView_Frame];
145 |
146 | }else{
147 |
148 | CGFloat wh = sourceView_Frame.size.width;
149 |
150 | CGFloat centerX = sourceView_Frame.origin.x + wh * 0.5;
151 | CGFloat centerY = sourceView_Frame.origin.y + wh * 0.5;
152 | CGPoint center = CGPointMake(centerX, centerY);
153 |
154 | fromPath = [UIBezierPath bezierPathWithArcCenter:center radius:maxRadius startAngle:0 endAngle:M_PI * 2 clockwise:YES];
155 | toPath = [UIBezierPath bezierPathWithArcCenter:center radius:wh*0.5 startAngle:0 endAngle:M_PI * 2 clockwise:YES];
156 | }
157 | }
158 |
159 |
160 |
161 |
162 | //创建一个在sourceView_Frame所指位置的ShapeLayer
163 | CAShapeLayer *shapeLayer = [CAShapeLayer layer];
164 | shapeLayer.path = fromPath.CGPath;
165 | shapeLayer.strokeColor = [UIColor greenColor].CGColor;
166 |
167 | animView.layer.mask = shapeLayer;
168 |
169 | CABasicAnimation *pathAnim = [CABasicAnimation animationWithKeyPath:@"path"];
170 | NSTimeInterval duration = [self transitionDuration:nil];
171 | pathAnim.toValue = (__bridge id _Nullable)(toPath.CGPath);
172 | pathAnim.duration = [self transitionDuration:nil];
173 | pathAnim.repeatCount = 1;
174 | pathAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
175 | pathAnim.delegate = self;
176 | pathAnim.fillMode = kCAFillModeForwards;
177 | pathAnim.removedOnCompletion = NO;
178 | [shapeLayer addAnimation:pathAnim forKey:@"pathAnim"];
179 |
180 | //执行补充动画
181 | // otherView.alpha = alpha_from;
182 | // otherView.transform = tranfrom_from;
183 | self.blurView.alpha = alpha_blur_from;
184 | [UIView animateWithDuration:duration animations:^{
185 |
186 | [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
187 |
188 | // otherView.alpha = alpha_to;
189 | // otherView.transform = tranfrom_to;
190 | self.blurView.alpha = alpha_blur_to;
191 | }];
192 |
193 | if(!isPush){
194 |
195 | if([toVc respondsToSelector:@selector(ShapeLayerAnimatedTransitioningProtocol_WillPop)]){
196 | [toVc ShapeLayerAnimatedTransitioningProtocol_WillPop];
197 | }
198 | }
199 | }
200 |
201 | -(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
202 |
203 | UIViewController * fromVc = [self.transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
204 | UIViewController * toVc = [self.transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
205 |
206 | //防止反弹
207 | self.blurView.alpha = 0;
208 | [self.blurView removeFromSuperview];
209 | fromVc.view.transform = CGAffineTransformIdentity;
210 | toVc.view.transform = CGAffineTransformIdentity;
211 | [toVc.view.layer.mask removeFromSuperlayer];
212 | toVc.view.layer.mask = nil;
213 | [fromVc.view.layer removeAllAnimations];
214 | [toVc.view.layer removeAllAnimations];
215 |
216 | [self.transitionContext completeTransition:YES];
217 |
218 | CoreNavVC *navVC = (CoreNavVC *)self.navVC;
219 |
220 | BOOL isPush = navVC.navType == NavTypePush;
221 |
222 | if(!isPush){
223 |
224 | if([toVc respondsToSelector:@selector(ShapeLayerAnimatedTransitioningProtocol_DidPop)]){
225 | [toVc ShapeLayerAnimatedTransitioningProtocol_DidPop];
226 | }
227 | }
228 | }
229 |
230 |
231 | -(UIView *)blurView{
232 |
233 | if(_blurView == nil){
234 |
235 | if([UIDevice currentDevice].systemVersion.floatValue >= 8.0){
236 |
237 |
238 | UIVisualEffectView *v = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
239 | _blurView = v;
240 |
241 | }else{
242 |
243 | UIToolbar *toolBar = [[UIToolbar alloc] init];
244 | toolBar.barStyle = UIBarStyleBlack;
245 | _blurView = toolBar;
246 |
247 | }
248 |
249 | }
250 |
251 | return _blurView;
252 | }
253 |
254 | @end
255 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #import
24 |
25 | /// "UINavigation+FDFullscreenPopGesture" extends UINavigationController's swipe-
26 | /// to-pop behavior in iOS 7+ by supporting fullscreen pan gesture. Instead of
27 | /// screen edge, you can now swipe from any place on the screen and the onboard
28 | /// interactive pop transition works seamlessly.
29 | ///
30 | /// Adding the implementation file of this category to your target will
31 | /// automatically patch UINavigationController with this feature.
32 | @interface UINavigationController (FDFullscreenPopGesture)
33 |
34 | /// The gesture recognizer that actually handles interactive pop.
35 | @property (nonatomic, strong, readonly) UIPanGestureRecognizer *fd_fullscreenPopGestureRecognizer;
36 |
37 | /// A view controller is able to control navigation bar's appearance by itself,
38 | /// rather than a global way, checking "fd_prefersNavigationBarHidden" property.
39 | /// Default to YES, disable it if you don't want so.
40 | @property (nonatomic, assign) BOOL fd_viewControllerBasedNavigationBarAppearanceEnabled;
41 |
42 | @end
43 |
44 | /// Allows any view controller to disable interactive pop gesture, which might
45 | /// be necessary when the view controller itself handles pan gesture in some
46 | /// cases.
47 | @interface UIViewController (FDFullscreenPopGesture)
48 |
49 | /// Whether the interactive pop gesture is disabled when contained in a navigation
50 | /// stack.
51 | @property (nonatomic, assign) BOOL fd_interactivePopDisabled;
52 |
53 | /// Indicate this view controller prefers its navigation bar hidden or not,
54 | /// checked when view controller based navigation bar's appearance is enabled.
55 | /// Default to NO, bars are more likely to show.
56 | @property (nonatomic, assign) BOOL fd_prefersNavigationBarHidden;
57 |
58 | /// Max allowed initial distance to left edge when you begin the interactive pop
59 | /// gesture. 0 by default, which means it will ignore this limit.
60 | @property (nonatomic, assign) CGFloat fd_interactivePopMaxAllowedInitialDistanceToLeftEdge;
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/NetWork/ToolNetWorkSolveVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // ToolNetWorkSolveVC.h
3 | // Car
4 | //
5 | // Created by muxi on 15/2/2.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ToolNetWorkSolveVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/NetWork/ToolNetWorkSolveVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // ToolNetWorkSolveVC.m
3 | // Car
4 | //
5 | // Created by muxi on 15/2/2.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import "ToolNetWorkSolveVC.h"
10 | #import "ToolNetWorkView.h"
11 |
12 | #define ios6x ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0f)
13 |
14 | @interface ToolNetWorkSolveVC ()
15 |
16 | @property (strong, nonatomic) IBOutlet NSLayoutConstraint *lineHConstraint;
17 |
18 | @end
19 |
20 | @implementation ToolNetWorkSolveVC
21 |
22 | - (void)viewDidLoad {
23 |
24 | [super viewDidLoad];
25 |
26 | self.title=@"无网络解决方案";
27 |
28 | self.lineHConstraint.constant=.5f;
29 |
30 | if(ios6x) return;
31 |
32 | self.edgesForExtendedLayout=UIRectEdgeNone;
33 | }
34 |
35 | -(void)viewWillAppear:(BOOL)animated{
36 |
37 | [super viewWillAppear:animated];
38 |
39 | [ToolNetWorkView dismissNetWordNotiInViewController:self.navigationController];
40 | }
41 |
42 | -(void)viewDidAppear:(BOOL)animated{
43 |
44 | [super viewDidAppear:animated];
45 |
46 | [ToolNetWorkView dismissNetWordNotiInViewController:self.navigationController];
47 | }
48 |
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/NetWork/ToolNetWorkSolveVC.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
44 |
50 |
56 |
62 |
68 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/NetWork/ToolNetWorkView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ToolNetWorkView.h
3 | // Car
4 | //
5 | // Created by muxi on 15/2/2.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ToolNetWorkView : UIView
12 |
13 |
14 | +(instancetype)netWorkViewWithViewController:(UIViewController *)vc;
15 |
16 |
17 |
18 | /**
19 | * 显示一个网络状态提示框
20 | */
21 | +(void)showNetWordNotiInViewController:(UIViewController *)vc y:(CGFloat)y;
22 |
23 | /**
24 | * 隐藏
25 | */
26 | +(void)dismissNetWordNotiInViewController:(UIViewController *)vc;
27 |
28 |
29 |
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/NetWork/ToolNetWorkView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ToolNetWorkView.m
3 | // Car
4 | //
5 | // Created by muxi on 15/2/2.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #import "ToolNetWorkView.h"
10 | #import "ToolNetWorkSolveVC.h"
11 |
12 |
13 | @interface ToolNetWorkView ()
14 |
15 | @property (nonatomic,strong) UIViewController *vc;
16 |
17 | @end
18 |
19 |
20 | @implementation ToolNetWorkView
21 |
22 |
23 | +(instancetype)netWorkViewWithViewController:(UIViewController *)vc{
24 |
25 | ToolNetWorkView *toolNetWorkView = [[[NSBundle mainBundle] loadNibNamed:@"ToolNetWorkView" owner:nil options:nil] firstObject];
26 |
27 | toolNetWorkView.vc=vc;
28 |
29 | return toolNetWorkView;
30 | }
31 |
32 | - (IBAction)tap:(UITapGestureRecognizer *)sender {
33 |
34 | ToolNetWorkSolveVC *netWorkSolveVC=[[ToolNetWorkSolveVC alloc] init];
35 | UINavigationController *navVC=(UINavigationController *)self.vc;
36 | [navVC pushViewController:netWorkSolveVC animated:YES];
37 | [self.class dismissNetWordNotiInViewController:self.vc];
38 | }
39 |
40 | #pragma mark 显示一个网络状态提示框
41 | +(void)showNetWordNotiInViewController:(UIViewController *)vc y:(CGFloat)y{
42 |
43 | dispatch_async(dispatch_get_main_queue(), ^{
44 |
45 | CGRect frame=CGRectMake(0, y, vc.view.bounds.size.width, 44.0f);
46 |
47 | ToolNetWorkView *netWorkView=[self checkNetWorkInViewController:vc needRemove:NO];
48 |
49 | if(netWorkView){
50 |
51 | [UIView animateWithDuration:.1f animations:^{
52 | netWorkView.frame=frame;
53 | }];
54 |
55 | return;
56 | }
57 |
58 | netWorkView=[ToolNetWorkView netWorkViewWithViewController:vc];
59 | netWorkView.frame=frame;
60 | [vc.view addSubview:netWorkView];
61 |
62 |
63 | netWorkView.alpha=.0f;
64 | [UIView animateWithDuration:.25f animations:^{
65 | netWorkView.alpha=1.0f;
66 | }];
67 |
68 | });
69 | }
70 |
71 |
72 | #pragma mark 隐藏网络状态提示框
73 | +(void)dismissNetWordNotiInViewController:(UIViewController *)vc{
74 |
75 | [self checkNetWorkInViewController:vc needRemove:YES];
76 | }
77 |
78 |
79 | +(ToolNetWorkView *)checkNetWorkInViewController:(UIViewController *)vc needRemove:(BOOL)needRemove{
80 |
81 | UIView *view=vc.view;
82 |
83 | ToolNetWorkView *netWorkView=nil;
84 |
85 |
86 | if(view==nil) return nil;
87 | if(view.subviews.count==0) return nil;
88 |
89 | for (UIView *v in view.subviews) {
90 | if([v isKindOfClass:self]){
91 |
92 | if(needRemove){
93 | dispatch_async(dispatch_get_main_queue(), ^{
94 | [UIView animateWithDuration:.25f animations:^{
95 | v.alpha=.0f;
96 | } completion:^(BOOL finished) {
97 | [v removeFromSuperview];
98 | }];
99 | });
100 | }else{
101 | netWorkView=(ToolNetWorkView *)v;
102 | }
103 |
104 | break;
105 | }
106 | }
107 |
108 | return netWorkView;
109 | }
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/NetWork/ToolNetWorkView.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 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/NextIndicator@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/NextIndicator@2x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/gesture@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/gesture@2x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/gesture@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/gesture@3x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/prompt_wifi@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/prompt_wifi@2x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return@2x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return@3x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return_hl@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return_hl@2x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return_hl@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/return_hl@3x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/roger@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/roger@2x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/roger@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/CoreNavVC/Lib/Resource/CoreNavVC.bundle/roger@3x.png
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/TipView/TipView.h:
--------------------------------------------------------------------------------
1 | //
2 | // TipView.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/9/6.
6 | // Copyright (c) 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface TipView : UIView
12 |
13 | @property (nonatomic,copy) void (^ClickDismissBtnBlock)();
14 |
15 |
16 |
17 | +(instancetype)tipView;
18 |
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/TipView/TipView.m:
--------------------------------------------------------------------------------
1 | //
2 | // TipView.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/9/6.
6 | // Copyright (c) 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "TipView.h"
10 |
11 |
12 | @implementation TipView
13 |
14 | -(void)awakeFromNib{
15 |
16 | [super awakeFromNib];
17 |
18 | [self addGestureRecognizer:[[UIPanGestureRecognizer alloc] init]];
19 | }
20 |
21 |
22 |
23 | +(instancetype)tipView{
24 |
25 | return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];
26 | }
27 |
28 | -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
29 | if(self.ClickDismissBtnBlock != nil) self.ClickDismissBtnBlock();
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/CoreNavVC/CoreNavVC/Lib/TipView/TipView.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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/CoreNavVC/FooterView.h:
--------------------------------------------------------------------------------
1 | //
2 | // FooterView.h
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/24.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface FooterView : UIView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/FooterView.m:
--------------------------------------------------------------------------------
1 | //
2 | // FooterView.m
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/24.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "FooterView.h"
10 |
11 | @implementation FooterView
12 |
13 | /*
14 | // Only override drawRect: if you perform custom drawing.
15 | // An empty implementation adversely affects performance during animation.
16 | - (void)drawRect:(CGRect)rect {
17 | // Drawing code
18 | }
19 | */
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/CoreNavVC/FooterView.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/CoreStatus.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNetWorkStatusObserver.h
3 | // CoreNetWorkStatusObserver
4 | //
5 | // Created by LiHaozhen on 15/5/2.
6 | // Copyright (c) 2015年 ihojin. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "Reachability.h"
11 | #import "CoreNetWorkStatus.h"
12 | #import "CoreStatusSingleton.h"
13 | #import "CoreStatusProtocol.h"
14 |
15 |
16 |
17 | @interface CoreStatus : NSObject
18 | HMSingletonH(CoreStatus)
19 |
20 |
21 | /** 获取当前网络状态:枚举 */
22 | +(CoreNetWorkStatus)currentNetWorkStatus;
23 |
24 | /** 获取当前网络状态:字符串 */
25 | +(NSString *)currentNetWorkStatusString;
26 |
27 |
28 | /** 开始网络监听 */
29 | +(void)beginNotiNetwork:(id)listener;
30 |
31 | /** 停止网络监听 */
32 | +(void)endNotiNetwork:(id)listener;
33 |
34 |
35 |
36 | /*
37 | * 新增API
38 | */
39 | /** 是否是Wifi */
40 | +(BOOL)isWifiEnable;
41 |
42 | /** 是否有网络 */
43 | +(BOOL)isNetworkEnable;
44 |
45 | /** 是否处于高速网络环境:3G、4G、Wifi */
46 | +(BOOL)isHighSpeedNetwork;
47 |
48 |
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/CoreStatus.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNetWorkStatusObserver.m
3 | // CoreNetWorkStatusObserver
4 | //
5 | // Created by LiHaozhen on 15/5/2.
6 | // Copyright (c) 2015年 ihojin. All rights reserved.
7 | //
8 |
9 | #import "CoreStatus.h"
10 | #import
11 |
12 |
13 | static NSString *const CoreStatusChangedNoti = @"CoreStatusChangedNoti";
14 |
15 |
16 | @interface CoreStatus ()
17 |
18 | /** 2G数组 */
19 | @property (nonatomic,strong) NSArray *technology2GArray;
20 |
21 | /** 3G数组 */
22 | @property (nonatomic,strong) NSArray *technology3GArray;
23 |
24 | /** 4G数组 */
25 | @property (nonatomic,strong) NSArray *technology4GArray;
26 |
27 | /** 网络状态中文数组 */
28 | @property (nonatomic,strong) NSArray *coreNetworkStatusStringArray;
29 |
30 | @property (nonatomic,strong) Reachability *reachability;
31 |
32 | @property (nonatomic,strong) CTTelephonyNetworkInfo *telephonyNetworkInfo;
33 |
34 | @property (nonatomic,copy) NSString *currentRaioAccess;
35 |
36 | /** 是否正在监听 */
37 | @property (nonatomic,assign) BOOL isNoti;
38 |
39 | @end
40 |
41 |
42 |
43 |
44 | @implementation CoreStatus
45 | HMSingletonM(CoreStatus)
46 |
47 |
48 |
49 | +(void)initialize{
50 |
51 | CoreStatus *status = [CoreStatus sharedCoreStatus];
52 | status.telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];
53 | }
54 |
55 |
56 |
57 |
58 | /** 获取当前网络状态:枚举 */
59 | +(CoreNetWorkStatus)currentNetWorkStatus{
60 |
61 | CoreStatus *status = [CoreStatus sharedCoreStatus];
62 |
63 | return [status statusWithRadioAccessTechnology];
64 | }
65 |
66 |
67 | /** 获取当前网络状态:字符串 */
68 | +(NSString *)currentNetWorkStatusString{
69 |
70 | CoreStatus *status = [CoreStatus sharedCoreStatus];
71 |
72 | return status.coreNetworkStatusStringArray[[self currentNetWorkStatus]];
73 | }
74 |
75 | -(Reachability *)reachability{
76 |
77 | if(_reachability == nil){
78 |
79 | _reachability = [Reachability reachabilityForInternetConnection];
80 | }
81 |
82 | return _reachability;
83 | }
84 |
85 |
86 | -(CTTelephonyNetworkInfo *)telephonyNetworkInfo{
87 |
88 | if(_telephonyNetworkInfo == nil){
89 |
90 | _telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];
91 |
92 | }
93 |
94 | return _telephonyNetworkInfo;
95 | }
96 |
97 |
98 | -(NSString *)currentRaioAccess{
99 |
100 | if(_currentRaioAccess == nil){
101 |
102 | _currentRaioAccess = self.telephonyNetworkInfo.currentRadioAccessTechnology;
103 | }
104 |
105 | return _currentRaioAccess;
106 | }
107 |
108 |
109 | /** 开始网络监听 */
110 | +(void)beginNotiNetwork:(id)listener{
111 |
112 | CoreStatus *status = [CoreStatus sharedCoreStatus];
113 |
114 | if(status.isNoti){
115 |
116 | NSLog(@"CoreStatus已经处于监听中,请检查其他页面是否关闭监听!");
117 |
118 | [self endNotiNetwork:(id)listener];
119 | }
120 |
121 | //注册监听
122 | [[NSNotificationCenter defaultCenter] addObserver:listener selector:@selector(coreNetworkChangeNoti:) name:CoreStatusChangedNoti object:status];
123 | [[NSNotificationCenter defaultCenter] addObserver:status selector:@selector(coreNetWorkStatusChanged:) name:kReachabilityChangedNotification object:nil];
124 | [[NSNotificationCenter defaultCenter] addObserver:status selector:@selector(coreNetWorkStatusChanged:) name:CTRadioAccessTechnologyDidChangeNotification object:nil];
125 |
126 | [status.reachability startNotifier];
127 |
128 | //标记
129 | status.isNoti = YES;
130 |
131 |
132 | }
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 | /** 停止网络监听 */
141 | +(void)endNotiNetwork:(id)listener{
142 |
143 | CoreStatus *status = [CoreStatus sharedCoreStatus];
144 |
145 | if(!status.isNoti){
146 |
147 | NSLog(@"CoreStatus监听已经被关闭"); return;
148 | }
149 |
150 | //解除监听
151 | [[NSNotificationCenter defaultCenter] removeObserver:status name:kReachabilityChangedNotification object:nil];
152 | [[NSNotificationCenter defaultCenter] removeObserver:status name:CTRadioAccessTechnologyDidChangeNotification object:nil];
153 | [[NSNotificationCenter defaultCenter] removeObserver:listener name:CoreStatusChangedNoti object:status];
154 |
155 | //标记
156 | status.isNoti = NO;
157 |
158 |
159 | }
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | - (void)coreNetWorkStatusChanged:(NSNotification *)notification
168 | {
169 | //发送通知
170 |
171 | if (notification.name == CTRadioAccessTechnologyDidChangeNotification &&
172 | notification.object != nil) {
173 |
174 | self.currentRaioAccess = self.telephonyNetworkInfo.currentRadioAccessTechnology;
175 | }
176 |
177 | //再次发出通知
178 | NSDictionary *userInfo = @{@"currentStatusEnum":@([CoreStatus currentNetWorkStatus]),@"currentStatusString":[CoreStatus currentNetWorkStatusString]};
179 |
180 | [[NSNotificationCenter defaultCenter] postNotificationName:CoreStatusChangedNoti object:self userInfo:userInfo];
181 | }
182 |
183 |
184 |
185 |
186 |
187 | - (CoreNetWorkStatus)statusWithRadioAccessTechnology{
188 |
189 | CoreNetWorkStatus status = (CoreNetWorkStatus)[self.reachability currentReachabilityStatus];
190 |
191 | NSString *technology = self.currentRaioAccess;
192 |
193 | if (status == CoreNetWorkStatusWWAN &&
194 | technology != nil) {
195 |
196 | if ([self.technology2GArray containsObject:technology]){
197 |
198 | status = CoreNetWorkStatus2G;
199 |
200 | }else if ([self.technology3GArray containsObject:technology])
201 |
202 | status = CoreNetWorkStatus3G;
203 |
204 | else if ([self.technology4GArray containsObject:technology]){
205 | status = CoreNetWorkStatus4G;
206 | }
207 |
208 | }
209 |
210 | return status;
211 | }
212 |
213 | /*
214 | * 懒加载
215 | */
216 | /** 2G数组 */
217 | -(NSArray *)technology2GArray{
218 |
219 | if(_technology2GArray == nil){
220 |
221 | _technology2GArray = @[CTRadioAccessTechnologyEdge,CTRadioAccessTechnologyGPRS];
222 | }
223 |
224 | return _technology2GArray;
225 | }
226 |
227 |
228 | /** 3G数组 */
229 | -(NSArray *)technology3GArray{
230 |
231 | if(_technology3GArray == nil){
232 |
233 | _technology3GArray = @[CTRadioAccessTechnologyHSDPA,
234 | CTRadioAccessTechnologyWCDMA,
235 | CTRadioAccessTechnologyHSUPA,
236 | CTRadioAccessTechnologyCDMA1x,
237 | CTRadioAccessTechnologyCDMAEVDORev0,
238 | CTRadioAccessTechnologyCDMAEVDORevA,
239 | CTRadioAccessTechnologyCDMAEVDORevB,
240 | CTRadioAccessTechnologyeHRPD];
241 | }
242 |
243 | return _technology3GArray;
244 | }
245 |
246 | /** 4G数组 */
247 | -(NSArray *)technology4GArray{
248 |
249 | if(_technology4GArray == nil){
250 |
251 | _technology4GArray = @[CTRadioAccessTechnologyLTE];
252 | }
253 |
254 | return _technology4GArray;
255 | }
256 |
257 | /** 网络状态中文数组 */
258 | -(NSArray *)coreNetworkStatusStringArray{
259 |
260 | if(_coreNetworkStatusStringArray == nil){
261 |
262 | _coreNetworkStatusStringArray = @[@"无网络",@"Wifi",@"蜂窝网络",@"2G",@"3G",@"4G",@"未知网络"];
263 | }
264 |
265 | return _coreNetworkStatusStringArray;
266 | }
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 | /** 是否是Wifi */
275 | +(BOOL)isWifiEnable{
276 |
277 | return [self currentNetWorkStatus] == CoreNetWorkStatusWifi;
278 | }
279 |
280 |
281 | /** 是否有网络 */
282 | +(BOOL)isNetworkEnable{
283 |
284 | CoreNetWorkStatus networkStatus = [self currentNetWorkStatus];
285 |
286 | return networkStatus!=CoreNetWorkStatusUnkhow && networkStatus != CoreNetWorkStatusNone;
287 | }
288 |
289 | /** 是否处于高速网络环境:3G、4G、Wifi */
290 | +(BOOL)isHighSpeedNetwork{
291 | CoreNetWorkStatus networkStatus = [self currentNetWorkStatus];
292 | return networkStatus == CoreNetWorkStatus3G || networkStatus == CoreNetWorkStatus4G || networkStatus == CoreNetWorkStatusWifi;
293 | }
294 |
295 | @end
296 |
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/Lib/CoreNetworkStatus.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreCoreNetWorkStatus.h
3 | // CoreStatus
4 | //
5 | // Created by 成林 on 15/7/6.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #ifndef CoreStatus_CoreCoreNetWorkStatus_h
10 | #define CoreStatus_CoreCoreNetWorkStatus_h
11 |
12 | /** 网络状态 */
13 | typedef enum{
14 |
15 | /** 无网络 */
16 | CoreNetWorkStatusNone=0,
17 |
18 | /** Wifi网络 */
19 | CoreNetWorkStatusWifi,
20 |
21 | /** 蜂窝网络 */
22 | CoreNetWorkStatusWWAN,
23 |
24 | /** 2G网络 */
25 | CoreNetWorkStatus2G,
26 |
27 | /** 3G网络 */
28 | CoreNetWorkStatus3G,
29 |
30 | /** 4G网络 */
31 | CoreNetWorkStatus4G,
32 |
33 | //未知网络
34 | CoreNetWorkStatusUnkhow
35 |
36 | }CoreNetWorkStatus;
37 |
38 |
39 |
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/Lib/CoreStatusProtocol.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreStatusProtocol.h
3 | // CoreStatus
4 | //
5 | // Created by 成林 on 15/7/6.
6 | // Copyright (c) 2015年 muxi. All rights reserved.
7 | //
8 |
9 | #ifndef CoreStatus_CoreStatusProtocol_h
10 | #define CoreStatus_CoreStatusProtocol_h
11 | #import "CoreNetworkStatus.h"
12 |
13 | @protocol CoreStatusProtocol
14 |
15 | @property (nonatomic,assign) NetworkStatus currentStatus;
16 |
17 | @optional
18 |
19 | /** 网络状态变更 */
20 | -(void)coreNetworkChangeNoti:(NSNotification *)noti;
21 |
22 | @end
23 |
24 |
25 |
26 |
27 |
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/Lib/Reachability/Reachability.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
7 | */
8 |
9 | #import
10 | #import
11 | #import
12 |
13 |
14 | typedef enum : NSInteger {
15 | NotReachable = 0,
16 | ReachableViaWiFi,
17 | ReachableViaWWAN
18 | } NetworkStatus;
19 |
20 | #pragma mark IPv6 Support
21 | //Reachability fully support IPv6. For full details, see ReadMe.md.
22 |
23 |
24 | extern NSString *kReachabilityChangedNotification;
25 |
26 |
27 | @interface Reachability : NSObject
28 |
29 | /*!
30 | * Use to check the reachability of a given host name.
31 | */
32 | + (instancetype)reachabilityWithHostName:(NSString *)hostName;
33 |
34 | /*!
35 | * Use to check the reachability of a given IP address.
36 | */
37 | + (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress;
38 |
39 | /*!
40 | * Checks whether the default route is available. Should be used by applications that do not connect to a particular host.
41 | */
42 | + (instancetype)reachabilityForInternetConnection;
43 |
44 |
45 | #pragma mark reachabilityForLocalWiFi
46 | //reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information.
47 | //+ (instancetype)reachabilityForLocalWiFi;
48 |
49 | /*!
50 | * Start listening for reachability notifications on the current run loop.
51 | */
52 | - (BOOL)startNotifier;
53 | - (void)stopNotifier;
54 |
55 | - (NetworkStatus)currentReachabilityStatus;
56 |
57 | /*!
58 | * WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand.
59 | */
60 | - (BOOL)connectionRequired;
61 |
62 | @end
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/Lib/Reachability/Reachability.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
7 | */
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | #import
16 |
17 | #import "Reachability.h"
18 |
19 | #pragma mark IPv6 Support
20 | //Reachability fully support IPv6. For full details, see ReadMe.md.
21 |
22 |
23 | NSString *kReachabilityChangedNotification = @"kNetworkReachabilityChangedNotification";
24 |
25 |
26 | #pragma mark - Supporting functions
27 |
28 | #define kShouldPrintReachabilityFlags 1
29 |
30 | static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
31 | {
32 | #if kShouldPrintReachabilityFlags
33 |
34 | NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
35 | (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
36 | (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
37 |
38 | (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
39 | (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
40 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
41 | (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
42 | (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
43 | (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
44 | (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
45 | comment
46 | );
47 | #endif
48 | }
49 |
50 |
51 | static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
52 | {
53 | #pragma unused (target, flags)
54 | NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
55 | NSCAssert([(__bridge NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
56 |
57 | Reachability* noteObject = (__bridge Reachability *)info;
58 | // Post a notification to notify the client that the network reachability changed.
59 | [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
60 | }
61 |
62 |
63 | #pragma mark - Reachability implementation
64 |
65 | @implementation Reachability
66 | {
67 | SCNetworkReachabilityRef _reachabilityRef;
68 | }
69 |
70 | + (instancetype)reachabilityWithHostName:(NSString *)hostName
71 | {
72 | Reachability* returnValue = NULL;
73 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
74 | if (reachability != NULL)
75 | {
76 | returnValue= [[self alloc] init];
77 | if (returnValue != NULL)
78 | {
79 | returnValue->_reachabilityRef = reachability;
80 | }
81 | else {
82 | CFRelease(reachability);
83 | }
84 | }
85 | return returnValue;
86 | }
87 |
88 |
89 | + (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress
90 | {
91 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, hostAddress);
92 |
93 | Reachability* returnValue = NULL;
94 |
95 | if (reachability != NULL)
96 | {
97 | returnValue = [[self alloc] init];
98 | if (returnValue != NULL)
99 | {
100 | returnValue->_reachabilityRef = reachability;
101 | }
102 | else {
103 | CFRelease(reachability);
104 | }
105 | }
106 | return returnValue;
107 | }
108 |
109 |
110 | + (instancetype)reachabilityForInternetConnection
111 | {
112 | struct sockaddr_in zeroAddress;
113 | bzero(&zeroAddress, sizeof(zeroAddress));
114 | zeroAddress.sin_len = sizeof(zeroAddress);
115 | zeroAddress.sin_family = AF_INET;
116 |
117 | return [self reachabilityWithAddress: (const struct sockaddr *) &zeroAddress];
118 | }
119 |
120 | #pragma mark reachabilityForLocalWiFi
121 | //reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information.
122 | //+ (instancetype)reachabilityForLocalWiFi
123 |
124 |
125 |
126 | #pragma mark - Start and stop notifier
127 |
128 | - (BOOL)startNotifier
129 | {
130 | BOOL returnValue = NO;
131 | SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
132 |
133 | if (SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context))
134 | {
135 | if (SCNetworkReachabilityScheduleWithRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
136 | {
137 | returnValue = YES;
138 | }
139 | }
140 |
141 | return returnValue;
142 | }
143 |
144 |
145 | - (void)stopNotifier
146 | {
147 | if (_reachabilityRef != NULL)
148 | {
149 | SCNetworkReachabilityUnscheduleFromRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
150 | }
151 | }
152 |
153 |
154 | - (void)dealloc
155 | {
156 | [self stopNotifier];
157 | if (_reachabilityRef != NULL)
158 | {
159 | CFRelease(_reachabilityRef);
160 | }
161 | }
162 |
163 |
164 | #pragma mark - Network Flag Handling
165 |
166 | - (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
167 | {
168 | PrintReachabilityFlags(flags, "networkStatusForFlags");
169 | if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
170 | {
171 | // The target host is not reachable.
172 | return NotReachable;
173 | }
174 |
175 | NetworkStatus returnValue = NotReachable;
176 |
177 | if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
178 | {
179 | /*
180 | If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
181 | */
182 | returnValue = ReachableViaWiFi;
183 | }
184 |
185 | if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
186 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
187 | {
188 | /*
189 | ... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
190 | */
191 |
192 | if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
193 | {
194 | /*
195 | ... and no [user] intervention is needed...
196 | */
197 | returnValue = ReachableViaWiFi;
198 | }
199 | }
200 |
201 | if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
202 | {
203 | /*
204 | ... but WWAN connections are OK if the calling application is using the CFNetwork APIs.
205 | */
206 | returnValue = ReachableViaWWAN;
207 | }
208 |
209 | return returnValue;
210 | }
211 |
212 |
213 | - (BOOL)connectionRequired
214 | {
215 | NSAssert(_reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
216 | SCNetworkReachabilityFlags flags;
217 |
218 | if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
219 | {
220 | return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
221 | }
222 |
223 | return NO;
224 | }
225 |
226 |
227 | - (NetworkStatus)currentReachabilityStatus
228 | {
229 | NSAssert(_reachabilityRef != NULL, @"currentNetworkStatus called with NULL SCNetworkReachabilityRef");
230 | NetworkStatus returnValue = NotReachable;
231 | SCNetworkReachabilityFlags flags;
232 |
233 | if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
234 | {
235 | returnValue = [self networkStatusForFlags:flags];
236 | }
237 |
238 | return returnValue;
239 | }
240 |
241 |
242 | @end
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreStatus/Lib/Singleton/CoreStatusSingleton.h:
--------------------------------------------------------------------------------
1 | // .h文件
2 | #define HMSingletonH(name) + (instancetype)shared##name;
3 |
4 | // .m文件
5 | #if __has_feature(objc_arc)
6 |
7 | #define HMSingletonM(name) \
8 | static id _instace; \
9 | \
10 | + (id)allocWithZone:(struct _NSZone *)zone \
11 | { \
12 | static dispatch_once_t onceToken; \
13 | dispatch_once(&onceToken, ^{ \
14 | _instace = [super allocWithZone:zone]; \
15 | }); \
16 | return _instace; \
17 | } \
18 | \
19 | + (instancetype)shared##name \
20 | { \
21 | static dispatch_once_t onceToken; \
22 | dispatch_once(&onceToken, ^{ \
23 | _instace = [[self alloc] init]; \
24 | }); \
25 | return _instace; \
26 | } \
27 | \
28 | - (id)copyWithZone:(NSZone *)zone \
29 | { \
30 | return _instace; \
31 | }
32 |
33 | #else
34 |
35 | #define HMSingletonM(name) \
36 | static id _instace; \
37 | \
38 | + (id)allocWithZone:(struct _NSZone *)zone \
39 | { \
40 | static dispatch_once_t onceToken; \
41 | dispatch_once(&onceToken, ^{ \
42 | _instace = [super allocWithZone:zone]; \
43 | }); \
44 | return _instace; \
45 | } \
46 | \
47 | + (instancetype)shared##name \
48 | { \
49 | static dispatch_once_t onceToken; \
50 | dispatch_once(&onceToken, ^{ \
51 | _instace = [[self alloc] init]; \
52 | }); \
53 | return _instace; \
54 | } \
55 | \
56 | - (id)copyWithZone:(NSZone *)zone \
57 | { \
58 | return _instace; \
59 | } \
60 | \
61 | - (oneway void)release { } \
62 | - (id)retain { return self; } \
63 | - (NSUInteger)retainCount { return 1;} \
64 | - (id)autorelease { return self;}
65 |
66 | #endif
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreTransition/CALayer+Transition.h:
--------------------------------------------------------------------------------
1 | //
2 | // CALayer+Transition.h
3 | // Carpenter
4 | //
5 | // Created by 冯成林 on 15/4/23.
6 | // Copyright (c) 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CALayer (Transition)
12 |
13 | /*
14 | * 动画类型
15 | */
16 | typedef enum{
17 |
18 | //水波
19 | TransitionAnimTypeRippleEffect=0,
20 |
21 | //吸走
22 | TransitionAnimTypeSuckEffect,
23 |
24 | //翻开书本
25 | TransitionAnimTypePageCurl,
26 |
27 | //正反翻转
28 | TransitionAnimTypeOglFlip,
29 |
30 | //正方体
31 | TransitionAnimTypeCube,
32 |
33 | //push推开
34 | TransitionAnimTypeReveal,
35 |
36 | //合上书本
37 | TransitionAnimTypePageUnCurl,
38 |
39 | //随机
40 | TransitionAnimTypeRamdom,
41 |
42 | }TransitionAnimType;
43 |
44 |
45 |
46 |
47 | /*
48 | * 动画方向
49 | */
50 | typedef enum{
51 |
52 | //从上
53 | TransitionSubtypesFromTop=0,
54 |
55 | //从左
56 | TransitionSubtypesFromLeft,
57 |
58 | //从下
59 | TransitionSubtypesFromBotoom,
60 |
61 | //从右
62 | TransitionSubtypesFromRight,
63 |
64 | //随机
65 | TransitionSubtypesFromRamdom,
66 |
67 | }TransitionSubType;
68 |
69 |
70 | /*
71 | * 动画曲线
72 | */
73 | typedef enum {
74 |
75 | //默认
76 | TransitionCurveDefault,
77 |
78 | //缓进
79 | TransitionCurveEaseIn,
80 |
81 | //缓出
82 | TransitionCurveEaseOut,
83 |
84 | //缓进缓出
85 | TransitionCurveEaseInEaseOut,
86 |
87 | //线性
88 | TransitionCurveLinear,
89 |
90 | //随机
91 | TransitionCurveRamdom,
92 |
93 | }TransitionCurve;
94 |
95 |
96 |
97 |
98 | /**
99 | * 转场动画
100 | *
101 | * @param animType 转场动画类型
102 | * @param subtype 转动动画方向
103 | * @param curve 转动动画曲线
104 | * @param duration 转动动画时长
105 | *
106 | * @return 转场动画实例
107 | */
108 | -(CATransition *)transitionWithAnimType:(TransitionAnimType)animType subType:(TransitionSubType)subType curve:(TransitionCurve)curve duration:(CGFloat)duration;
109 |
110 | @end
111 |
--------------------------------------------------------------------------------
/CoreNavVC/Framework/CoreTransition/CALayer+Transition.m:
--------------------------------------------------------------------------------
1 | //
2 | // CALayer+Transition.m
3 | // Carpenter
4 | //
5 | // Created by 冯成林 on 15/4/23.
6 | // Copyright (c) 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "CALayer+Transition.h"
10 |
11 | @implementation CALayer (Transition)
12 |
13 |
14 | /**
15 | * 转场动画
16 | *
17 | * @param animType 转场动画类型
18 | * @param subtype 转动动画方向
19 | * @param curve 转动动画曲线
20 | * @param duration 转动动画时长
21 | *
22 | * @return 转场动画实例
23 | */
24 | -(CATransition *)transitionWithAnimType:(TransitionAnimType)animType subType:(TransitionSubType)subType curve:(TransitionCurve)curve duration:(CGFloat)duration{
25 |
26 | NSString *key = @"transition";
27 |
28 | if([self animationForKey:key]!=nil){
29 | [self removeAnimationForKey:key];
30 | }
31 |
32 |
33 | CATransition *transition=[CATransition animation];
34 |
35 | //动画时长
36 | transition.duration=duration;
37 |
38 | //动画类型
39 | transition.type=[self animaTypeWithTransitionType:animType];
40 |
41 | //动画方向
42 | transition.subtype=[self animaSubtype:subType];
43 |
44 | //缓动函数
45 | transition.timingFunction=[CAMediaTimingFunction functionWithName:[self curve:curve]];
46 |
47 | //完成动画删除
48 | transition.removedOnCompletion = YES;
49 |
50 | [self addAnimation:transition forKey:key];
51 |
52 | return transition;
53 | }
54 |
55 |
56 |
57 | /*
58 | * 返回动画曲线
59 | */
60 | -(NSString *)curve:(TransitionCurve)curve{
61 |
62 | //曲线数组
63 | NSArray *funcNames=@[kCAMediaTimingFunctionDefault,kCAMediaTimingFunctionEaseIn,kCAMediaTimingFunctionEaseInEaseOut,kCAMediaTimingFunctionEaseOut,kCAMediaTimingFunctionLinear];
64 |
65 | return [self objFromArray:funcNames index:curve isRamdom:(TransitionCurveRamdom == curve)];
66 | }
67 |
68 |
69 |
70 | /*
71 | * 返回动画方向
72 | */
73 | -(NSString *)animaSubtype:(TransitionSubType)subType{
74 |
75 | //设置转场动画的方向
76 | NSArray *subtypes=@[kCATransitionFromTop,kCATransitionFromLeft,kCATransitionFromBottom,kCATransitionFromRight];
77 |
78 | return [self objFromArray:subtypes index:subType isRamdom:(TransitionSubtypesFromRamdom == subType)];
79 | }
80 |
81 |
82 |
83 |
84 | /*
85 | * 返回动画类型
86 | */
87 | -(NSString *)animaTypeWithTransitionType:(TransitionAnimType)type{
88 |
89 | //设置转场动画的类型
90 | NSArray *animArray=@[@"rippleEffect",@"suckEffect",@"pageCurl",@"oglFlip",@"cube",@"reveal",@"pageUnCurl",@"push"];
91 |
92 | return [self objFromArray:animArray index:type isRamdom:(TransitionAnimTypeRamdom == type)];
93 | }
94 |
95 |
96 |
97 | /*
98 | * 统一从数据返回对象
99 | */
100 | -(id)objFromArray:(NSArray *)array index:(NSUInteger)index isRamdom:(BOOL)isRamdom{
101 |
102 | NSUInteger count = array.count;
103 |
104 | NSUInteger i = isRamdom?arc4random_uniform((u_int32_t)count) : index;
105 |
106 | return array[i];
107 | }
108 |
109 |
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/CoreNavVC/HomeCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // HomeCell.h
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/24.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HomeCell : UITableViewCell
12 |
13 | @property (weak, nonatomic) IBOutlet UILabel *mainLabel;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CoreNavVC/HomeCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // HomeCell.m
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/24.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "HomeCell.h"
10 | #import "AppNavVC.h"
11 |
12 | @interface HomeCell ()
13 |
14 | @property (weak, nonatomic) IBOutlet UIView *redDot;
15 |
16 | @end
17 |
18 | @implementation HomeCell
19 |
20 | - (void)awakeFromNib {
21 | [super awakeFromNib];
22 | // Initialization code
23 | self.redDot.layer.cornerRadius = 3;
24 | UIView *bgView = [UIView new];
25 | bgView.backgroundColor = YeahColor;
26 |
27 | }
28 |
29 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
30 | [super setSelected:selected animated:animated];
31 |
32 | // Configure the view for the selected state
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/CoreNavVC/HomeCell.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 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/CoreNavVC/HomeTVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // HomeTVC.h
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/24.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CoreNavVC.h"
11 |
12 | @interface HomeTVC : UITableViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/CoreNavVC/HomeTVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // HomeTVC.m
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/24.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "HomeTVC.h"
10 | #import "FooterView.h"
11 | #import "HomeCell.h"
12 | #import "AppNavVC.h"
13 | #import "PopBackVC.h"
14 | #import "ZoomScaleVC.h"
15 | #import "RotationVC.h"
16 |
17 | @interface HomeTVC ()
18 |
19 | @property (nonatomic,strong) NSArray *dataList;
20 |
21 | @end
22 |
23 | @implementation HomeTVC
24 |
25 | - (void)viewDidLoad {
26 |
27 | [super viewDidLoad];
28 |
29 | self.dataList = @[@"-----------(1)基础篇-----------",@"一键定制NavBar",@"PopGesture",@"仿QQ无网络检测(断开WIFI)",@"拦截Pop返回事件",@"",@"-----------(2)扩展篇-----------",@"下拉放大与动态透明导航条",@"",@"-----------(3)炫酷篇-----------",@"一键旋转转场动画(仿酷狗)"];
30 |
31 | self.tableView.tableFooterView = [UIView new];
32 |
33 | CGRect f = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 260);
34 | UIView *footerView = [[NSBundle mainBundle] loadNibNamed:@"FooterView" owner:nil options:nil].lastObject;
35 | footerView.frame = f;
36 | self.tableView.tableFooterView = footerView;
37 | self.view.backgroundColor = [UIColor blackColor];
38 | self.tableView.separatorColor = [UIColor whiteColor];
39 | self.tableView.rowHeight = 80;
40 | self.tabBarController.tabBar.tintColor = YeahColor;
41 | self.extendedLayoutIncludesOpaqueBars = YES;
42 | }
43 |
44 |
45 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
46 |
47 | return self.dataList.count;
48 | }
49 |
50 |
51 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
52 |
53 | static NSString *rid = @"HomeTVCCell";
54 |
55 | HomeCell *cell = [tableView dequeueReusableCellWithIdentifier:rid];
56 |
57 | if (cell == nil){
58 |
59 | cell = [[NSBundle mainBundle] loadNibNamed:@"HomeCell" owner:nil options:nil].lastObject;
60 |
61 | }
62 |
63 | cell.mainLabel.text = self.dataList[indexPath.row];
64 |
65 | return cell;
66 | }
67 |
68 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
69 |
70 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
71 |
72 | UIViewController *nextVC = nil;
73 |
74 |
75 |
76 | if (indexPath.row == 2){
77 |
78 | UIViewController *vc = [UIViewController new];
79 |
80 | vc.view.backgroundColor = [UIColor blackColor];
81 | nextVC = vc;
82 | }else if (indexPath.row == 4){
83 |
84 | PopBackVC *vc = [PopBackVC new];
85 | vc.view.backgroundColor = [UIColor whiteColor];
86 | nextVC = vc;
87 | }else if (indexPath.row == 7){
88 |
89 | ZoomScaleVC *vc = [[ZoomScaleVC alloc] initWithNibName:@"ZoomScaleVC" bundle:nil];
90 |
91 | nextVC = vc;
92 | }else if (indexPath.row == 10){
93 |
94 | RotationVC *vc = [[RotationVC alloc] initWithNibName:@"RotationVC" bundle:nil];
95 |
96 | nextVC = vc;
97 | }
98 |
99 | nextVC.title = self.dataList[indexPath.row];
100 |
101 | [self.navigationController pushViewController:nextVC animated:YES];
102 | }
103 |
104 | -(CGPoint)RotationAnimatedTransitioningProtocol_anchorPoint{
105 | return CGPointMake(1, 1);
106 | }
107 | -(BOOL)RotationAnimatedTransitioningProtocol_isClockWise{
108 | return YES;
109 | }
110 |
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/1.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "1.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "minimum-system-version" : "7.0",
7 | "scale" : "2x"
8 | },
9 | {
10 | "orientation" : "portrait",
11 | "idiom" : "iphone",
12 | "minimum-system-version" : "7.0",
13 | "subtype" : "retina4",
14 | "scale" : "2x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/logo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "logo.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/logo.imageset/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/Images.xcassets/logo.imageset/logo.png
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/team.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "team.jpg",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/CoreNavVC/Images.xcassets/team.imageset/team.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlinFeng/CoreNavVC/997120c350edcb30ab52fa143147da346c830d75/CoreNavVC/Images.xcassets/team.imageset/team.jpg
--------------------------------------------------------------------------------
/CoreNavVC/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | HM.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/CoreNavVC/PopBackVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // PopBackVC.h
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/25.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PopBackVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/PopBackVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // PopBackVC.m
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/5/25.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "PopBackVC.h"
10 | #import "CoreNavVC.h"
11 |
12 | @interface PopBackVC ()
13 |
14 | @end
15 |
16 | @implementation PopBackVC
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | __weak typeof(self) weakSelf=self;
22 |
23 | self.PopAction = ^{
24 |
25 | UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"拦截Pop事件" message:@"无需自定义即可拦截Pop事件" delegate:weakSelf cancelButtonTitle:@"很强大" otherButtonTitles:@"我要Pop", nil];
26 |
27 | [av show];
28 | };
29 |
30 | }
31 |
32 |
33 | -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
34 |
35 | if (buttonIndex == 1){
36 |
37 | [self.navigationController popViewControllerAnimated:YES];
38 | }
39 | }
40 |
41 | - (void)didReceiveMemoryWarning {
42 | [super didReceiveMemoryWarning];
43 | // Dispose of any resources that can be recreated.
44 | }
45 |
46 | /*
47 | #pragma mark - Navigation
48 |
49 | // In a storyboard-based application, you will often want to do a little preparation before navigation
50 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
51 | // Get the new view controller using [segue destinationViewController].
52 | // Pass the selected object to the new view controller.
53 | }
54 | */
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/CoreNavVC/README.md:
--------------------------------------------------------------------------------
1 |
2 | CoreNavVC(关注[信息公告牌](https://github.com/CharlinFeng/Show))
3 | ===============
4 | .Objective-c
5 | .Xcode 7
6 | .时点软件内部使用
7 |
8 |
9 | 框架演示
10 | ===============
11 |
12 | 
13 |
14 |
15 | 框架说明
16 | ===============
17 |
18 | 注:请直接拖拽CoreNavVC文件夹到你的项目即可,不支持pod。
19 |
20 |
21 | >1.原创框架,依赖CoreStatus监听网络,直接即可使用。
22 | >2.全自动滑动返回,使用runtime实现,高效完美。
23 | >3.仿QQ网络监听并显示网络视图。
24 | >4.封装更新好的显示与隐藏导航栏。
25 | >5.更好的把控导航条内部控件。
26 | >6.增加分类更方便的增加返回功能。
27 | >7.一键集成透明导航栏。
28 | >8.一键集成下拉放大,并实现对任意UIView的操纵,而不仅仅是UIImageView。
29 |
30 |
31 |
32 |
33 | 使用说明
34 | ===============
35 |
36 | ####1.导入
37 | 直接拖拽CoreNavVC文件夹到您项目中,并集成CoreStatus即可。
38 |
39 |
40 |
41 |
42 | ####2.显示与聊天导航条
43 | 由于封装的要求,你的显示与隐藏导航条应该是统一放在一个控制器内部,并实现对称性:
44 | 注:由于有滑动返回手势的存在,所以最好按如下方式控制导航条的隐藏与还原;
45 |
46 | -(void)viewWillDisappear:(BOOL)animated{
47 |
48 | [super viewWillDisappear:animated];
49 |
50 | [self.navigationController showNavBarWithAnim:YES];
51 | }
52 |
53 | -(void)viewDidDisappear:(BOOL)animated{
54 |
55 | [super viewDidDisappear:animated];
56 |
57 | [self.navigationController showNavBarWithAnim:YES];
58 | }
59 |
60 | //此处必写,KVO监听必须注销,否则crash
61 | -(void)dealloc{
62 | [self removeScrollNavbarWithScrollView:self.tableView];
63 | }
64 |
65 |
66 |
67 | ####3.添加一个顶部视图
68 | 您需要特别注意的是,有以下四点:
69 | (1).您的控制器必须是UIViewController或其子类,不能直接是UITableViewController
70 | (2).顶部视图不能直接为tableView的tableViewHeaderView添加。框架使用runtime做了成员属性,
71 | 任意UIViewController都有一个叫topView的成员属性,直接把您的顶部视图使用这个指针引用即可。
72 | 您也不需要为这个视图添加约束,因为他是基于frame管理计算。此外,你还不需要指定frame。
73 | 你只需如下操作即可;
74 |
75 | self.topView = [HeaderTopView topView]; //直接赋值,无需任何frame或autolayout
76 |
77 | (3).调用方法一键集成下拉放大效果:
78 |
79 | [self addScrollNavbarWithScrollView:self.tableView autoToggleNavbarHeight:30 topView:self.topView originHeight:200];
80 |
81 | 其中,autoToggleNavbarHeight指的是下拉多大距离导航条开始动态改变透明度。
82 | originHeight表示您的顶部视图topView你希望有多高。
83 |
84 |
85 | ##### 特别说明,如何才能产生下拉放大效果?
86 | 其实下拉放大有很多种效果,有的是直接拉imageView,但更多的app的下拉放大,您会发现拉的imageView的顶部还有很多其他控件,现实中就不是拉一个imageView这么简单。
87 | 我在制作本框架思考了很多天,最终使用了一个比较聪明的方法,此方法可以兼容一切下拉放大效果,请注意他的本质,
没并有拉任何imageView。框架内部是将刚刚您的topView执行了高度layout操作。当然topView被layout了,
其内部的子控件也会相应被layout,需要产生下拉放大效果,您需要将imageView和topView的高度关联。
88 | 同时请注意一些子控件如果不需要动态layout,请设置子控件的约束从topView的底部为标准来约束。
89 | 此外:imageView的contentModel最好设置为:aspectFill
90 |
91 |
92 |
93 | 重要事项
94 | ===============
95 | 框架使用了KVO,请注意一定在在生命周期中remove监听,就是上面dealloc里面的那个方法。
96 |
--------------------------------------------------------------------------------
/CoreNavVC/RotationVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // RotationVC.h
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/6/19.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CoreNavVC.h"
11 |
12 | @interface RotationVC : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/CoreNavVC/RotationVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // RotationVC.m
3 | // CoreNavVC
4 | //
5 | // Created by Charlin on 16/6/19.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "RotationVC.h"
10 |
11 | @interface RotationVC ()
12 |
13 | @end
14 |
15 | @implementation RotationVC
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | // Do any additional setup after loading the view from its nib.
20 | self.extendedLayoutIncludesOpaqueBars = YES;
21 | }
22 |
23 | - (void)didReceiveMemoryWarning {
24 | [super didReceiveMemoryWarning];
25 | // Dispose of any resources that can be recreated.
26 | }
27 |
28 | -(CGPoint)RotationAnimatedTransitioningProtocol_anchorPoint{
29 | return CGPointMake(1, 1);
30 | }
31 | -(BOOL)RotationAnimatedTransitioningProtocol_isClockWise{
32 | return YES;
33 | }
34 |
35 | /*
36 | #pragma mark - Navigation
37 |
38 | // In a storyboard-based application, you will often want to do a little preparation before navigation
39 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
40 | // Get the new view controller using [segue destinationViewController].
41 | // Pass the selected object to the new view controller.
42 | }
43 | */
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/CoreNavVC/RotationVC.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 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/CoreNavVC/TopView.h:
--------------------------------------------------------------------------------
1 | //
2 | // TopView.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/6/12.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface TopView : UIView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/TopView.m:
--------------------------------------------------------------------------------
1 | //
2 | // TopView.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/6/12.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "TopView.h"
10 |
11 | @implementation TopView
12 |
13 | /*
14 | // Only override drawRect: if you perform custom drawing.
15 | // An empty implementation adversely affects performance during animation.
16 | - (void)drawRect:(CGRect)rect {
17 | // Drawing code
18 | }
19 | */
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/CoreNavVC/TopView.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
27 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/CoreNavVC/ZoomScaleVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZoomScaleVC.h
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/6/12.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ZoomScaleVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CoreNavVC/ZoomScaleVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZoomScaleVC.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 16/6/12.
6 | // Copyright © 2016年 冯成林. All rights reserved.
7 | //
8 |
9 | #import "ZoomScaleVC.h"
10 | #import "TopView.h"
11 | #import "CoreNavVC.h"
12 |
13 | @interface ZoomScaleVC ()
14 |
15 | @property (weak, nonatomic) IBOutlet UITableView *tableView;
16 |
17 |
18 | @end
19 |
20 |
21 | @implementation ZoomScaleVC
22 |
23 | -(void)viewDidLoad{
24 |
25 | [super viewDidLoad];
26 |
27 | self.tableView.dataSource = self;
28 | self.tableView.delegate = self;
29 |
30 | //安装
31 | self.nav_topView = [[NSBundle mainBundle] loadNibNamed:@"TopView" owner:nil options:nil].lastObject;
32 |
33 | [self addScrollNavbarWithScrollView:self.tableView autoToggleNavbarHeight:240 originHeight:200];
34 |
35 | self.enableParallax = YES;
36 | self.parallaxValue = 100;
37 | }
38 |
39 | -(void)viewWillAppear:(BOOL)animated{
40 |
41 | [super viewWillAppear:animated];
42 |
43 | [self viewWillAppear_scrollNavbar];
44 | }
45 |
46 |
47 |
48 |
49 | -(void)viewWillDisappear:(BOOL)animated{
50 |
51 | [super viewWillDisappear:animated];
52 |
53 | [self viewWillDisappear_scrollNavbar];
54 | }
55 |
56 | -(void)dealloc{
57 |
58 | [self removeScrollNavbarWithScrollView:self.tableView];
59 | }
60 |
61 |
62 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {return 40;}
63 |
64 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
65 |
66 | UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
67 |
68 | cell.textLabel.text = [NSString stringWithFormat:@"%i",indexPath.row];
69 |
70 | return cell;
71 | }
72 |
73 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
74 |
75 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
76 | }
77 |
78 | @end
79 |
--------------------------------------------------------------------------------
/CoreNavVC/ZoomScaleVC.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/CoreNavVC/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // CoreNavVC
4 | //
5 | // Created by 冯成林 on 15/9/5.
6 | // Copyright (c) 2015年 冯成林. 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 |
--------------------------------------------------------------------------------
/CoreNavVCTests/CoreNavVCTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreNavVCTests.m
3 | // CoreNavVCTests
4 | //
5 | // Created by 冯成林 on 15/9/5.
6 | // Copyright (c) 2015年 冯成林. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface CoreNavVCTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation CoreNavVCTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/CoreNavVCTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | HM.$(PRODUCT_NAME:rfc1034identifier)
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | CoreNavVC (连载中,关注[信息公告牌](https://github.com/CharlinFeng/Show))
3 | ==========
4 | ### 成都时点软件4年精华无私奉献开源(注意查看上面commits数量)
5 |
6 | 
7 | 
8 | 
9 | 
10 |
11 |
12 | #### .Xcode 7.3
13 | #### .iOS7,如果不使用自定义转场动画,最低可以支持到iOS6
14 | #### .OC,Swift完美支持
15 |
16 |
17 |
18 | ## 一.为什么要开源?
19 | 开源是一种精神,时点软件感谢大家长期的支持与厚爱,无私开源奉献给大家,希望继续能支持我们:(成都时点软件冯成林在中国开发者排行榜单中OC排名国内10位,Swfit排名位于第9位,感谢大家支持, [Objective-C排行榜](http://githuber.cn/search?language=Objective-C),[Swfit排行榜](http://githuber.cn/search?language=Swift))
20 | > (1). 本框架是Charlin Feng项目必备的基础类框架。
21 | > (2). 此框架已经在我自己的10多个正式项目中全面使用。
22 | > (3). 多达4年经验精华积累,让框架更稳定好用实用
23 | > (4). 关于NavVC的很多功能,我发现是可以全部集成,不过后面发现有很多好用有趣的框架级功能被世界级githuber写的很零散,其实他们都是属于同一个体系的,这也是NavVC出现的必然理由!
24 |
25 | 注:框架功能太多,这里暂时不一一列表,请详细查看下面功能特性详解。
26 |
27 |
28 |
29 |
30 | ## 二.基础篇
31 |
32 | 提示:在一切开始前,请自定义您的导航控制器比如AppNavVC,继承自CoreNavVC
33 |
34 |
35 | ##### 1.一句代码定制导航条样式
36 |
37 | 
38 |
39 | [self navBarAppearanceWithBgColor:[UIColor blackColor] textColor:YeahColor titleFontPoint:18 itemFontPoint:15];
40 |
41 | 其中,BgColor是指导航条的背景色,textColor指文字颜色,titleFontPoint为titleLabel的文字大小,itemFontPoint为左右label文字大小。
42 |
43 |
44 | ##### 2.PopGesture
45 |
46 | 注:本功能是集成了FDPopGesture,但对源码做了一定的改动
47 | 
48 |
49 | >. 全自动的PopGesture
50 | >. 自动判断并显示PopGesture提示视图
51 |
52 |
53 | 以下是本功能的一些使用细节:
54 | (1)手势提示视图已自动处理,你无需处理。
55 | (2)禁用手势直接在VC调用:
56 |
57 | [self popGestureEnable:NO]; //VC Runtime
58 |
59 |
60 | (3)启用手势直接在VC调用:
61 |
62 | [self popGestureEnable:YES]; //VC Runtime
63 |
64 |
65 |
66 | ##### 3.自动处理Tabbar
67 | 你会发现,框架已经自动处理了在Push与Pop过程中tabbar的自动隐藏与显示,应该就是你直接想要的效果。
68 |
69 |
70 |
71 | ##### 4.仿QQ无网络实时检测
72 |
73 | 
74 | 你无需任何操作,框架已经全自动处理了网络实时监控。(你可以断开Mac的Wifi测试)
75 | 温馨提示:网络解决方案里面有时点软件落款,别忘了修改,小心扣工资!
76 |
77 |
78 |
79 |
80 | ##### 5.bgView的处理
81 | 这个是一个细节,你需要了解的,在navBar的内部,其实是有很多层,navBar和Tabbar与Toolbar机制不完全一样,单从半透明模糊效果来说,navBar和Tabbar内部有一个BlurView,在BlurView下面还有一个bgView,框架已经将这个bgView完全透明化。方便我们做出一些想要的NavBar颜色出来。如果你想了解细节,可以搜索findBgView方法。
82 |
83 |
84 |
85 |
86 | ##### 6.拦截Pop返回事件
87 | 
88 |
89 | 你只需直接实现VC的PopAction的Block即可(VC Runtime)。
90 |
91 | self.PopAction = ^{
92 | //do sth
93 | };
94 |
95 |
96 | 注意:
97 | > 1.此功能一般是保存资料,下单付款页面应用较多。
98 | > 2.特别强调,你需要配置刚刚的PopGesture,因为这个pop被拦截,但PopGesture仍然是可用的,另忘了禁用与开启PopGesture。
99 |
100 |
101 |
102 |
103 |
104 |
105 | ## 三.扩展篇(灵感来自淘宝iPhone版商品详情)
106 |
107 | #### 1.任意View的下拉放大(支持ScrollView,tableview,CollectionView)
108 |
109 | 
110 |
111 |
112 | ##### (1)特别说明:其他Github上面有很多关于下拉放大的写法,我之前也写过一个OC版本的([CorePullScale](https://github.com/CharlinFeng/CorePullScale)),不过这样做一般有很多问题:
113 | >1. 框架零散,下拉放大其实还是属于我个人认为的导航控制器的一种封装,因为一般下拉放大会关联动态改变导航条的样式,透明度等。
114 | >2. 最致命的是一般写的下拉放大是只考虑如何放大一个imageView,比如有的app的我的页面,他顶部确实有一个头像,不过在imageView上面还有很多其他控件,如用户昵称,年龄,私信等等其他控件。那么单纯实现一个imageView的下拉放大,将仅仅是一个意义不大的功能。
115 |
116 |
117 | 所以本框架的下拉放大,重点是在解决如何集成在合理的位置,同时如果将下拉放大上升到任意View都可以支持下拉放大的需求空间,让下拉放大可以容纳更多的子控件。极大的让需求变化无限可能。
118 | ##### (2)使用细节,想要实现任意View的下拉放大,来自我自己想到的一个想法,当前你如果要实现这个效果,除了使用框架,还必须要注意以下细节,才能出现下拉放大效果,否则可能会达不到你想要的效果。
119 | >1. 需要定制一个view,view最好是autolayout布局。且view内部应该有一个imageView子控件。
120 | >2. 下拉放大的视觉效果应该是imageView产生的,imageView的高度上应该和父类高度有关联
121 | >3. imageView的contentModel最好是设置为AspectFill,并且clipsToBounds.
122 | >4. 查看框架演示中,如果想要控件子控件在view中位置固定,直接正确设置对应的autolayout即可。
123 |
124 |
125 | 使用方法如下,请直接在控制器中操作:
126 |
127 | //安装 (基于Runtime,请将下拉放大的view直接传递给runtime生成的成员变量nav_topView中即可)
128 | self.nav_topView = [[NSBundle mainBundle] loadNibNamed:@"TopView" owner:nil options:nil].lastObject;
129 | [self addScrollNavbarWithScrollView:self.tableView autoToggleNavbarHeight:240 originHeight:200];
130 |
131 | ### 特别注意:
132 | >1.下拉放大产生的本质是scrollView动态修改了view的高度,并且触发了view的layoutsubviews。
133 | >2.同时请注意下拉放大的view请不要记录成员变量,不需要你手动添加到scrollview中.
134 | >3.基于Runtime,请将下拉放大的view直接传递给runtime生成的成员变量nav_topView中即可
135 | >4.ScrollView表示需要传入页面中引起下拉放大的scrollview,originHeight表示nav_topView你想要的高度,autoToggleNavbarHeight表示引起导航条由透明到不透明开始变化反应的临界值。
136 |
137 | ### 其他重要事项说明:
138 | 框架考虑了众多因素,同时这些功能在我自己项目中已经使用了几年,且经历了10来个版本迭代,一切是为了解耦。同时考虑了与我自己其他框架的兼容以及很多各种各样的其他问题,所以框架你还需要做以下操作:
139 |
140 | -(void)viewWillAppear:(BOOL)animated{
141 |
142 | [super viewWillAppear:animated];
143 | [self viewWillAppear_scrollNavbar]; //调用代码1
144 | }
145 | -(void)viewWillDisappear:(BOOL)animated{
146 |
147 | [super viewWillDisappear:animated];
148 | [self viewWillDisappear_scrollNavbar];//调用代码2
149 | }
150 | -(void)dealloc{
151 | [self removeScrollNavbarWithScrollView:self.tableView];//调用代码3
152 | }
153 |
154 | 注意:
155 | >1.如果不调用代码1,你会发现没有下拉放大效果。
156 | >2.如果不调用代码2,你会发现在push下级页面会发生非常多的bug。
157 | >3.如果不调用代码3,你会发现pop的时侯,程序崩溃,因为框架内部使用了通知与KVO。
158 |
159 |
160 | #### 2.PopBtn 一键添加Pop按钮
161 |
162 | 
163 | 在app中,经常会出现有的页面因为顶部有大图,或者有幻灯,或者有视频,或者其他原因隐藏了导航条,需要手动添加一个PopBtn的情况,这同样是一种和导航控制器有关的一种需求。请在控制器直接执行以下方法即可:
164 |
165 | /** 添加pop返回功能 */
166 | [self addPopFunctionWithAnim:YES]; //参数表示是否需要动画
167 |
168 |
169 | #### 3.动态修改导航条透明度
170 |
171 | 
172 | 注:已经自动实现
173 |
174 |
175 | #### 4.与PopGesture的兼容
176 |
177 | 
178 | 注:已经自动实现
179 |
180 |
181 | #### 5.仿淘宝商品详情上拉视差(Runtime)
182 |
183 | 
184 | 注:默认是无视差效果,即上下滚动步调与tableview的offset一致
185 |
186 |
187 | 
188 | 注:开启视差效果,即上下滚动步调与tableview的offset不一致。(可配置)
189 | 开启视差:
190 |
191 | self.enableParallax = YES; //开启视差
192 | self.parallaxValue = 100; //视差值,建议100-250
193 |
194 |
195 |
196 | ## 四.炫酷篇 (多达4-5种炫酷特效,一键调用实现,请持续关注!)
197 |
198 |
199 | #### 一大波炫酷功能正在路上,连载中,未完待续,敬请期待!!!
200 |
--------------------------------------------------------------------------------