Skip to content

Commit af9ac9c

Browse files
ZYNZYN
ZYN
authored and
ZYN
committed
修改弹出控制器后,再pop到跟控制的小bug
1 parent e863376 commit af9ac9c

File tree

9 files changed

+155
-42
lines changed

9 files changed

+155
-42
lines changed

YNNavigationController.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
2E28B02E1D52F20300C63612 /* NSObject+YNAssociateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E28B02D1D52F20300C63612 /* NSObject+YNAssociateObject.m */; };
1111
2E28B0311D5314B600C63612 /* YNScreenShotView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E28B0301D5314B600C63612 /* YNScreenShotView.m */; };
1212
2E28B0341D5314FF00C63612 /* UIViewController+YNNavigationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E28B0331D5314FF00C63612 /* UIViewController+YNNavigationViewController.m */; };
13+
2E2D39AF1D75350C00612B72 /* GoodsShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E2D39AE1D75350C00612B72 /* GoodsShareViewController.m */; };
1314
2E3F26091D49DBA40042E303 /* TestNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E3F26081D49DBA30042E303 /* TestNavigationController.m */; };
1415
2E3F26101D49ED8B0042E303 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 2E3F260E1D49ED8B0042E303 /* [email protected] */; };
1516
2E3F26111D49ED8B0042E303 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 2E3F260F1D49ED8B0042E303 /* [email protected] */; };
@@ -33,6 +34,8 @@
3334
2E28B0301D5314B600C63612 /* YNScreenShotView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNScreenShotView.m; sourceTree = "<group>"; };
3435
2E28B0321D5314FF00C63612 /* UIViewController+YNNavigationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+YNNavigationViewController.h"; sourceTree = "<group>"; };
3536
2E28B0331D5314FF00C63612 /* UIViewController+YNNavigationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+YNNavigationViewController.m"; sourceTree = "<group>"; };
37+
2E2D39AD1D75350C00612B72 /* GoodsShareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoodsShareViewController.h; sourceTree = "<group>"; };
38+
2E2D39AE1D75350C00612B72 /* GoodsShareViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoodsShareViewController.m; sourceTree = "<group>"; };
3639
2E3F26071D49DBA30042E303 /* TestNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestNavigationController.h; sourceTree = "<group>"; };
3740
2E3F26081D49DBA30042E303 /* TestNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestNavigationController.m; sourceTree = "<group>"; };
3841
2E3F260E1D49ED8B0042E303 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
@@ -178,6 +181,8 @@
178181
2EA0929B1D48586A000C75C5 /* GoodShare(商品分享) */ = {
179182
isa = PBXGroup;
180183
children = (
184+
2E2D39AD1D75350C00612B72 /* GoodsShareViewController.h */,
185+
2E2D39AE1D75350C00612B72 /* GoodsShareViewController.m */,
181186
);
182187
path = "GoodShare(商品分享)";
183188
sourceTree = "<group>";
@@ -291,6 +296,7 @@
291296
2EA092951D484F66000C75C5 /* YNNavigationController.m in Sources */,
292297
2E3F26181D4AF5960042E303 /* ProductAddressDetailViewController.m in Sources */,
293298
2EA092AA1D485C5C000C75C5 /* ProductDetailViewController.m in Sources */,
299+
2E2D39AF1D75350C00612B72 /* GoodsShareViewController.m in Sources */,
294300
2EA092981D4851F4000C75C5 /* BaseViewController.m in Sources */,
295301
2EA092781D484ECD000C75C5 /* AppDelegate.m in Sources */,
296302
2EA092751D484ECD000C75C5 /* main.m in Sources */,

YNNavigationController.xcodeproj/xcuserdata/zyn.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+44-32
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@
33
type = "1"
44
version = "2.0">
55
<Breakpoints>
6-
<BreakpointProxy
7-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
8-
<BreakpointContent
9-
shouldBeEnabled = "No"
10-
ignoreCount = "0"
11-
continueAfterRunningActions = "No"
12-
filePath = "YNNavigationController/Demo/Home(&#x9996;&#x9875;)/ProductList(&#x5546;&#x54c1;&#x5217;&#x8868;)/ProductListViewController.m"
13-
timestampString = "491451873.436969"
14-
startingColumnNumber = "9223372036854775807"
15-
endingColumnNumber = "9223372036854775807"
16-
startingLineNumber = "31"
17-
endingLineNumber = "31"
18-
landmarkName = "-tapOnClick"
19-
landmarkType = "5">
20-
</BreakpointContent>
21-
</BreakpointProxy>
226
<BreakpointProxy
237
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
248
<BreakpointContent
@@ -58,13 +42,11 @@
5842
ignoreCount = "0"
5943
continueAfterRunningActions = "No"
6044
filePath = "YNNavigationController/Libs/YNNavigationController/YNNavigationController.m"
61-
timestampString = "491985851.15445"
45+
timestampString = "494221615.910606"
6246
startingColumnNumber = "9223372036854775807"
6347
endingColumnNumber = "9223372036854775807"
64-
startingLineNumber = "421"
65-
endingLineNumber = "421"
66-
landmarkName = "-popToViewController:animated:"
67-
landmarkType = "5">
48+
startingLineNumber = "428"
49+
endingLineNumber = "428">
6850
</BreakpointContent>
6951
</BreakpointProxy>
7052
<BreakpointProxy
@@ -74,13 +56,11 @@
7456
ignoreCount = "0"
7557
continueAfterRunningActions = "No"
7658
filePath = "YNNavigationController/Libs/YNNavigationController/YNNavigationController.m"
77-
timestampString = "491985851.15445"
59+
timestampString = "494221615.910606"
7860
startingColumnNumber = "9223372036854775807"
7961
endingColumnNumber = "9223372036854775807"
80-
startingLineNumber = "423"
81-
endingLineNumber = "423"
82-
landmarkName = "@implementation YNNavigationController"
83-
landmarkType = "3">
62+
startingLineNumber = "430"
63+
endingLineNumber = "430">
8464
</BreakpointContent>
8565
</BreakpointProxy>
8666
<BreakpointProxy
@@ -90,11 +70,11 @@
9070
ignoreCount = "0"
9171
continueAfterRunningActions = "No"
9272
filePath = "YNNavigationController/Libs/YNNavigationController/YNNavigationController.m"
93-
timestampString = "491985851.15445"
73+
timestampString = "494221615.910606"
9474
startingColumnNumber = "9223372036854775807"
9575
endingColumnNumber = "9223372036854775807"
96-
startingLineNumber = "407"
97-
endingLineNumber = "407"
76+
startingLineNumber = "414"
77+
endingLineNumber = "414"
9878
landmarkName = "-popToViewController:animated:"
9979
landmarkType = "5">
10080
</BreakpointContent>
@@ -282,11 +262,11 @@
282262
ignoreCount = "0"
283263
continueAfterRunningActions = "No"
284264
filePath = "YNNavigationController/Libs/YNNavigationController/YNNavigationController.m"
285-
timestampString = "491985851.15445"
265+
timestampString = "494221615.910606"
286266
startingColumnNumber = "9223372036854775807"
287267
endingColumnNumber = "9223372036854775807"
288-
startingLineNumber = "405"
289-
endingLineNumber = "405"
268+
startingLineNumber = "412"
269+
endingLineNumber = "412"
290270
landmarkName = "-popToViewController:animated:"
291271
landmarkType = "5">
292272
</BreakpointContent>
@@ -355,5 +335,37 @@
355335
landmarkType = "5">
356336
</BreakpointContent>
357337
</BreakpointProxy>
338+
<BreakpointProxy
339+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
340+
<BreakpointContent
341+
shouldBeEnabled = "No"
342+
ignoreCount = "0"
343+
continueAfterRunningActions = "No"
344+
filePath = "YNNavigationController/Demo/TestNavigationController.m"
345+
timestampString = "494220895.148789"
346+
startingColumnNumber = "9223372036854775807"
347+
endingColumnNumber = "9223372036854775807"
348+
startingLineNumber = "28"
349+
endingLineNumber = "28"
350+
landmarkName = "-pushViewController:animated:"
351+
landmarkType = "5">
352+
</BreakpointContent>
353+
</BreakpointProxy>
354+
<BreakpointProxy
355+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
356+
<BreakpointContent
357+
shouldBeEnabled = "No"
358+
ignoreCount = "0"
359+
continueAfterRunningActions = "No"
360+
filePath = "YNNavigationController/Libs/YNNavigationController/YNNavigationController.m"
361+
timestampString = "494221624.027347"
362+
startingColumnNumber = "9223372036854775807"
363+
endingColumnNumber = "9223372036854775807"
364+
startingLineNumber = "405"
365+
endingLineNumber = "405"
366+
landmarkName = "-popToRootViewControllerAnimated:"
367+
landmarkType = "5">
368+
</BreakpointContent>
369+
</BreakpointProxy>
358370
</Breakpoints>
359371
</Bucket>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// GoodsShareViewController.h
3+
// YNNavigationController
4+
//
5+
// Created by ZYN on 16/8/30.
6+
// Copyright © 2016年 Yongneng Zheng. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface GoodsShareViewController : BaseViewController
12+
13+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// GoodsShareViewController.m
3+
// YNNavigationController
4+
//
5+
// Created by ZYN on 16/8/30.
6+
// Copyright © 2016年 Yongneng Zheng. All rights reserved.
7+
//
8+
9+
#import "GoodsShareViewController.h"
10+
11+
@interface GoodsShareViewController ()
12+
13+
@end
14+
15+
@implementation GoodsShareViewController
16+
17+
- (void)viewDidLoad {
18+
[super viewDidLoad];
19+
// Do any additional setup after loading the view.
20+
self.title = @"商品分享";
21+
UIButton *btn = [[UIButton alloc]initWithFrame:self.view.bounds];
22+
[btn setTitle:@"点我,快点我" forState:UIControlStateNormal];
23+
[btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside];
24+
[self.view addSubview:btn];
25+
}
26+
27+
28+
- (void)tapOnClick{
29+
30+
[self.navigationController popToRootViewControllerAnimated:YES];
31+
32+
33+
}
34+
35+
36+
- (void)didReceiveMemoryWarning {
37+
[super didReceiveMemoryWarning];
38+
// Dispose of any resources that can be recreated.
39+
}
40+
41+
/*
42+
#pragma mark - Navigation
43+
44+
// In a storyboard-based application, you will often want to do a little preparation before navigation
45+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
46+
// Get the new view controller using [segue destinationViewController].
47+
// Pass the selected object to the new view controller.
48+
}
49+
*/
50+
51+
@end

YNNavigationController/Demo/Discover(发现)/DiscoverViewController.m

+16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
#import "DiscoverViewController.h"
10+
#import "GoodsShareViewController.h"
1011

1112
@interface DiscoverViewController ()
1213

@@ -25,12 +26,27 @@ - (void)viewDidLoad{
2526

2627
self.title = @"发现";
2728

29+
self.view.backgroundColor = [UIColor greenColor];
2830

31+
UIButton *btn = [[UIButton alloc]initWithFrame:self.view.bounds];
32+
[btn setTitle:@"点我,快点我" forState:UIControlStateNormal];
33+
[btn addTarget:self action:@selector(tapOnClick) forControlEvents:UIControlEventTouchUpInside];
34+
[self.view addSubview:btn];
2935

3036

3137

3238

3339
}
3440

41+
- (void)tapOnClick{
42+
43+
GoodsShareViewController *v= [[GoodsShareViewController alloc]init];
44+
45+
46+
[self.navigationController pushViewController:v animated:YES];
47+
48+
49+
50+
}
3551

3652
@end

YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductDetail(商品详情)/AddressDetail(详细地址)/ProductAddressDetailViewController.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ - (void)tapOnClick{
6262
}
6363

6464
- (void)tapOnClick2{
65-
66-
[(YNNavigationController *)self.navigationController yn_popToRootViewControllerWithCompletionBlock:nil];
67-
// [self.navigationController popToRootViewControllerAnimated:YES];
65+
//
66+
// [(YNNavigationController *)self.navigationController yn_popToRootViewControllerWithCompletionBlock:nil];
67+
[self.navigationController popToRootViewControllerAnimated:YES];
6868
}
6969

7070
- (void)popToPre{

YNNavigationController/Demo/Home(首页)/ProductList(商品列表)/ProductListViewController.m

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#import "ProductListViewController.h"
1010
#import "ProductDetailViewController.h"
11-
#import "YNNavigationController.h"
11+
#import "DiscoverViewController.h"
12+
#import "TestNavigationController.h"
1213

1314
@implementation ProductListViewController
1415
- (void)viewDidLoad{
@@ -30,6 +31,15 @@ - (void)tapOnClick{
3031

3132
[self.navigationController pushViewController:[[ProductDetailViewController alloc]init] animated:YES];
3233

34+
35+
// DiscoverViewController * v = [[DiscoverViewController alloc]init];
36+
//
37+
// TestNavigationController *NA = [[TestNavigationController alloc]initWithRootViewController:v];
38+
//
39+
// [self presentViewController:NA animated:YES completion:nil];
40+
41+
42+
3343
}
3444

3545

YNNavigationController/Demo/TestNavigationController.m

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)ani
2525

2626
viewController.hidesBottomBarWhenPushed = YES;
2727

28-
[super pushViewController:viewController animated:animated];
29-
3028
if (self.childViewControllers.count) {
3129
UIBarButtonItem *left = [self.class barButtonItemWithImage:[UIImage imageNamed:@"back-.png"] ImageH:[UIImage imageNamed:@"back-"] target:self action:@selector(popToPre) forControlEvents:UIControlEventTouchUpInside];
3230
viewController.navigationItem.leftBarButtonItem = left;
3331
}
34-
32+
[super pushViewController:viewController animated:animated];
3533
}
3634

3735
- (void)popToPre{

YNNavigationController/Libs/YNNavigationController/YNNavigationController.m

+10-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ - (void)viewDidLoad{
4646

4747
- (void)panGesListener:(UIPanGestureRecognizer *)panGes{
4848

49-
if (self.viewControllers.count == 1) return;
49+
if (self.viewControllers.count <= 1) return;
5050
UIViewController *lastViewController = [self.viewControllers lastObject];
5151
UIView *topView = self.view;
5252

@@ -392,8 +392,15 @@ - (UIViewController *)popViewControllerAnimated:(BOOL)animated{
392392

393393
- (NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated{
394394

395-
[YN_SHOTVIEW.arrayScreenShots removeAllObjects];
396-
YN_SHOTVIEW.imgView.image = nil;
395+
396+
for (int i = 0; i < self.viewControllers.count - 1; i++) {
397+
[YN_SHOTVIEW.arrayScreenShots removeLastObject];
398+
UIImage *image = [YN_SHOTVIEW.arrayScreenShots lastObject];
399+
400+
YN_SHOTVIEW.imgView.image = image;
401+
402+
}
403+
397404

398405
return [super popToRootViewControllerAnimated:animated];
399406

0 commit comments

Comments
 (0)