Skip to content

Commit f2ef7d6

Browse files
committed
RunLoop
1 parent 8fb6bdd commit f2ef7d6

File tree

16 files changed

+676
-144
lines changed

16 files changed

+676
-144
lines changed

Person.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ NS_ASSUME_NONNULL_BEGIN
1212

1313
@interface Person : NSObject
1414

15+
@property(nonatomic, strong) NSString *name;
16+
-(void)eat;
17+
18+
@end
19+
20+
@interface student : Person
1521

1622
@end
1723

Person.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010

1111
@implementation Person
1212

13+
-(void)eat {
14+
NSLog(@"开始吃饭");
15+
}
1316

1417
@end
18+
19+

WGFcodeNotes-Bridging-Header.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
#import "WGTestModel.h"
88
#import "WGFirstVC.h"
99
#import "WGMonitorManage.h"
10-
11-
10+
#import "WGRunLoopVC.h"
11+
#import "WGRunLoopSecondVC.h"

WGFcodeNotes.xcodeproj/project.pbxproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
548F332B24F2B87300AB3540 /* Person.m in Sources */ = {isa = PBXBuildFile; fileRef = 548F332A24F2B87300AB3540 /* Person.m */; };
6262
548F332E24F2B8D100AB3540 /* Person+PersonCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 548F332D24F2B8D100AB3540 /* Person+PersonCategory.m */; };
6363
54CBAE2824FFE4E500AEA0E5 /* iOS内存分区.md in Resources */ = {isa = PBXBuildFile; fileRef = 54CBAE2724FFE4E500AEA0E5 /* iOS内存分区.md */; };
64+
54E19658250909050064027B /* WGRunLoopVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E19657250909050064027B /* WGRunLoopVC.m */; };
65+
54E1965B250A70A90064027B /* WGThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E1965A250A70A90064027B /* WGThread.m */; };
66+
54E1965E250A7BDC0064027B /* WGRunLoopSecondVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E1965D250A7BDC0064027B /* WGRunLoopSecondVC.m */; };
67+
54E19661250E750B0064027B /* WGProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 54E19660250E750B0064027B /* WGProxy.m */; };
6468
/* End PBXBuildFile section */
6569

6670
/* Begin PBXContainerItemProxy section */
@@ -152,6 +156,14 @@
152156
548F332C24F2B8D100AB3540 /* Person+PersonCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Person+PersonCategory.h"; sourceTree = "<group>"; };
153157
548F332D24F2B8D100AB3540 /* Person+PersonCategory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Person+PersonCategory.m"; sourceTree = "<group>"; };
154158
54CBAE2724FFE4E500AEA0E5 /* iOS内存分区.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "iOS内存分区.md"; sourceTree = "<group>"; };
159+
54E19656250909050064027B /* WGRunLoopVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WGRunLoopVC.h; sourceTree = "<group>"; };
160+
54E19657250909050064027B /* WGRunLoopVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WGRunLoopVC.m; sourceTree = "<group>"; };
161+
54E19659250A70A90064027B /* WGThread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WGThread.h; sourceTree = "<group>"; };
162+
54E1965A250A70A90064027B /* WGThread.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WGThread.m; sourceTree = "<group>"; };
163+
54E1965C250A7BDC0064027B /* WGRunLoopSecondVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WGRunLoopSecondVC.h; sourceTree = "<group>"; };
164+
54E1965D250A7BDC0064027B /* WGRunLoopSecondVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WGRunLoopSecondVC.m; sourceTree = "<group>"; };
165+
54E1965F250E750B0064027B /* WGProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WGProxy.h; sourceTree = "<group>"; };
166+
54E19660250E750B0064027B /* WGProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WGProxy.m; sourceTree = "<group>"; };
155167
/* End PBXFileReference section */
156168

157169
/* Begin PBXFrameworksBuildPhase section */
@@ -184,6 +196,14 @@
184196
children = (
185197
3015810B245577A600EC6001 /* WGMonitorManage.h */,
186198
3015810C245577A600EC6001 /* WGMonitorManage.m */,
199+
54E19656250909050064027B /* WGRunLoopVC.h */,
200+
54E19657250909050064027B /* WGRunLoopVC.m */,
201+
54E19659250A70A90064027B /* WGThread.h */,
202+
54E1965A250A70A90064027B /* WGThread.m */,
203+
54E1965C250A7BDC0064027B /* WGRunLoopSecondVC.h */,
204+
54E1965D250A7BDC0064027B /* WGRunLoopSecondVC.m */,
205+
54E1965F250E750B0064027B /* WGProxy.h */,
206+
54E19660250E750B0064027B /* WGProxy.m */,
187207
);
188208
path = WGCore;
189209
sourceTree = "<group>";
@@ -507,11 +527,15 @@
507527
buildActionMask = 2147483647;
508528
files = (
509529
548AC957242F4B3100EEE11C /* ViewController.swift in Sources */,
530+
54E19661250E750B0064027B /* WGProxy.m in Sources */,
510531
30160A2924A75A970074FB82 /* BinaryTree.m in Sources */,
532+
54E1965B250A70A90064027B /* WGThread.m in Sources */,
533+
54E19658250909050064027B /* WGRunLoopVC.m in Sources */,
511534
548F332B24F2B87300AB3540 /* Person.m in Sources */,
512535
548AC983242F4C7100EEE11C /* WGMainVC.swift in Sources */,
513536
548F332E24F2B8D100AB3540 /* Person+PersonCategory.m in Sources */,
514537
30FD75F824357E3800431678 /* WGMainObjcVC.m in Sources */,
538+
54E1965E250A7BDC0064027B /* WGRunLoopSecondVC.m in Sources */,
515539
3015810D245577A600EC6001 /* WGMonitorManage.m in Sources */,
516540
301CF1BC2452BE310024EC69 /* WGFirstVC.m in Sources */,
517541
548AC953242F4B3100EEE11C /* AppDelegate.swift in Sources */,

WGFcodeNotes/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2424
// self.window?.rootViewController = WGMainObjcVC()
2525
// self.window?.rootViewController = UINavigationController.init(rootViewController: WGFirstVC())
2626
// self.window?.rootViewController = UINavigationController.init(rootViewController: ViewController())
27-
self.window?.rootViewController = UINavigationController(rootViewController: WGMainObjcVC())
27+
self.window?.rootViewController = UINavigationController(rootViewController: WGRunLoopSecondVC())
2828
self.window?.makeKeyAndVisible()
2929
}
3030
return true

WGFcodeNotes/SceneDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
3131
// self.window?.rootViewController = WGMainObjcVC()
3232
//self.window?.rootViewController = UINavigationController.init(rootViewController: WGFirstVC())
3333
// self.window?.rootViewController = UINavigationController.init(rootViewController: ViewController())
34-
self.window?.rootViewController = UINavigationController(rootViewController: WGMainObjcVC())
34+
self.window?.rootViewController = UINavigationController(rootViewController: WGRunLoopSecondVC())
3535
self.window?.makeKeyAndVisible()
3636
}
3737

WGFcodeNotes/WGCore/WGProxy.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// WGProxy.h
3+
// WGFcodeNotes
4+
//
5+
// Created by wubaicai on 2020/9/13.
6+
// Copyright © 2020 WG. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
/// NSProxy消息转发的基类
14+
@interface WGProxy : NSProxy
15+
@property(nonatomic, weak) id target;
16+
@end
17+
18+
NS_ASSUME_NONNULL_END

WGFcodeNotes/WGCore/WGProxy.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// WGProxy.m
3+
// WGFcodeNotes
4+
//
5+
// Created by wubaicai on 2020/9/13.
6+
// Copyright © 2020 WG. All rights reserved.
7+
//
8+
9+
#import "WGProxy.h"
10+
11+
@implementation WGProxy
12+
//作用就是 消息转发
13+
-(void)forwardInvocation:(NSInvocation *)invocation {
14+
[invocation invokeWithTarget:self.target];
15+
}
16+
17+
-(NSMethodSignature *)methodSignatureForSelector:(SEL)sel {
18+
return [self.target methodSignatureForSelector:sel];
19+
}
20+
@end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// WGRunLoopSecondVC.h
3+
// WGFcodeNotes
4+
//
5+
// Created by wubaicai on 2020/9/10.
6+
// Copyright © 2020 WG. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface WGRunLoopSecondVC : UIViewController
14+
15+
16+
@end
17+
18+
NS_ASSUME_NONNULL_END
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// WGRunLoopSecondVC.m
3+
// WGFcodeNotes
4+
//
5+
// Created by wubaicai on 2020/9/10.
6+
// Copyright © 2020 WG. All rights reserved.
7+
//
8+
9+
#import "WGRunLoopSecondVC.h"
10+
#import "WGRunLoopVC.h"
11+
@interface WGRunLoopSecondVC ()
12+
13+
@end
14+
15+
@implementation WGRunLoopSecondVC
16+
17+
- (void)viewDidLoad {
18+
[super viewDidLoad];
19+
self.view.backgroundColor = [UIColor blueColor];
20+
// Do any additional setup after loading the view.
21+
}
22+
23+
/*
24+
#pragma mark - Navigation
25+
26+
// In a storyboard-based application, you will often want to do a little preparation before navigation
27+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
28+
// Get the new view controller using [segue destinationViewController].
29+
// Pass the selected object to the new view controller.
30+
}
31+
*/
32+
33+
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
34+
[self.navigationController pushViewController:[[WGRunLoopVC alloc]init] animated:YES];
35+
}
36+
37+
38+
@end

0 commit comments

Comments
 (0)