-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
386 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// NNProxy.h | ||
// NNNavigationBar | ||
// | ||
// Created by GuHaijun on 2019/7/19. | ||
// Copyright © 2019 GuHaijun. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NNProxy : NSProxy | ||
|
||
@property (nonatomic, weak, readonly)id target; | ||
+ (instancetype)proxyWithTarget:(id)target; | ||
- (instancetype)initWithTarget:(id)target; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// NNProxy.m | ||
// NNNavigationBar | ||
// | ||
// Created by GuHaijun on 2019/7/19. | ||
// Copyright © 2019 GuHaijun. All rights reserved. | ||
// | ||
|
||
#import "NNProxy.h" | ||
|
||
@implementation NNProxy | ||
|
||
+ (instancetype)proxyWithTarget:(id)target{ | ||
return [[self alloc] initWithTarget:target]; | ||
} | ||
|
||
- (instancetype)initWithTarget:(id)target{ | ||
_target = target; | ||
return self; | ||
} | ||
|
||
- (BOOL)respondsToSelector:(SEL)aSelector{ | ||
return [self.target respondsToSelector:aSelector]; | ||
} | ||
|
||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector{ | ||
return [self.target methodSignatureForSelector:aSelector]; | ||
} | ||
|
||
- (void)forwardInvocation:(NSInvocation *)invocation{ | ||
SEL sel = [invocation selector]; | ||
if ([self.target respondsToSelector:sel]) { | ||
[invocation invokeWithTarget:self.target]; | ||
} | ||
} | ||
|
||
@end |
Oops, something went wrong.