DKWechatHelper/dkhelper/dkhelperDylib/Logos/dkhelperDylib.xm
DKJone b2ddc1ad24 init project
添加初始项目
2019-01-23 11:38:18 +08:00

61 lines
1010 B
Plaintext

// See http://iphonedevwiki.net/index.php/Logos
#import <UIKit/UIKit.h>
@interface CustomViewController
@property (nonatomic, copy) NSString* newProperty;
+ (void)classMethod;
- (NSString*)getMyName;
- (void)newMethod:(NSString*) output;
@end
%hook CustomViewController
+ (void)classMethod
{
%log;
%orig;
}
%new
-(void)newMethod:(NSString*) output{
NSLog(@"This is a new method : %@", output);
}
%new
- (id)newProperty {
return objc_getAssociatedObject(self, @selector(newProperty));
}
%new
- (void)setNewProperty:(id)value {
objc_setAssociatedObject(self, @selector(newProperty), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSString*)getMyName
{
%log;
NSString* password = MSHookIvar<NSString*>(self,"_password");
NSLog(@"password:%@", password);
[%c(CustomViewController) classMethod];
[self newMethod:@"output"];
self.newProperty = @"newProperty";
NSLog(@"newProperty : %@", self.newProperty);
return %orig();
}
%end