作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
是否可以使用 theos/logos 在 Hook 方法中创建自定义属性?
例子:
//define my custom property
@interface SBAwayController : NSObject {
UIView *myCustomView;
}
@property (nonatomic, retain) UIView *myCustomView;
@end
%hook SBAwayController
- (void)activate {
//call original method
%orig;
//use my custom property
if (tweakEnabled)
[self.awayView addSubview:myCustomView];
}
%end
我已经按照上面的示例进行了尝试,但没有成功。
最佳答案
另一种方法是创建一个单例类来保存您的对象/上下文。以这个Introspy hook class为例. tracerStorage
是在类外定义的变量,所有 Hook 都访问它。
要将其应用于您的案例,您可以拥有一个外部变量 NSMutableDictionary,其中当前的 SBAwayController
作为键,属性 myCustomView
作为值。
关于iphone - 如何在 theos/logos 中创建自定义属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18069071/
我是一名优秀的程序员,十分优秀!