【问题标题】:unable to hook to a ui view inside interface无法连接到界面内的 ui 视图
【发布时间】:2020-02-27 20:03:09
【问题描述】:

我正在使用 THEOS,并且我知道如何挂钩方法和覆盖等等。但现在我想做的是,我想访问在 (@interface) 中声明的 UI 视图。

这里是我指的头文件:

@class NSString, UILabel, UINavigationBar, UISwitch;

__attribute__((visibility("hidden")))
@interface SettingsViewController : UIViewController <UINavigationBarDelegate, UIBarPositioningDelegate>
{
UINavigationBar *navBar;
UISwitch *alertSwitch;
UISwitch *lightSwitch;
UISwitch *lockSwitch;
UISwitch *infoSwitch;
UILabel *alertLabel;
UILabel *lightLabel;
UILabel *lockLabel;
UILabel *showInfoLabel;
UILabel *infoLabel;
}

@property(retain, nonatomic) UILabel *infoLabel; // @synthesize infoLabel;
@property(retain, nonatomic) UILabel *showInfoLabel; // @synthesize showInfoLabel;
@property(retain, nonatomic) UILabel *lockLabel; // @synthesize lockLabel;
@property(retain, nonatomic) UILabel *lightLabel; // @synthesize lightLabel;
@property(retain, nonatomic) UILabel *alertLabel; // @synthesize alertLabel;
@property(retain, nonatomic) UISwitch *infoSwitch; // @synthesize infoSwitch;
@property(retain, nonatomic) UISwitch *lockSwitch; // @synthesize lockSwitch;
@property(retain, nonatomic) UISwitch *lightSwitch; // @synthesize lightSwitch;
@property(retain, nonatomic) UISwitch *alertSwitch; // @synthesize alertSwitch;
@property(retain, nonatomic) UINavigationBar *navBar; // @synthesize navBar;
- (void).cxx_destruct;
- (void)didReceiveMemoryWarning;
- (void)dismissSettingsViewController;
- (long long)preferredStatusBarStyle;
- (void)showDevInfo;
- (void)infoSwitchSwitched;
- (void)lockSwitchSwitched;
- (void)lightSwitchSwitched;
- (void)alertSwitchSwitched;
- (void)viewDidLoad;
- (long long)positionForBar:(id)arg1;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end

我想访问@interface 下的 UI 视图(例如:UISwitch *alertSwitch;)。

如何访问它?请帮助我自三天以来一直在努力解决问题:(。非常感谢任何帮助或建议。

【问题讨论】:

    标签: objective-c model-view-controller interface theos


    【解决方案1】:

    希望对你有帮助

    %hook SettingsViewController
    -(void) WhereEverYouWantToRunYourCode {
    
          self.alertSwitch = ....
    
        }
    
        %end 
    

    【讨论】:

      猜你喜欢
      • 2021-12-08
      • 1970-01-01
      • 1970-01-01
      • 2015-11-20
      • 2021-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多