gpt4 book ai didi

iphone - 如何在 theos/logos 中创建自定义属性?

转载 作者:搜寻专家 更新时间:2023-10-30 19:49:13 24 4
gpt4 key购买 nike

是否可以使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com