невозможно подключиться к интерфейсу пользователя внутри интерфейса - PullRequest
0 голосов
/ 27 февраля 2020

Я использую THEOS, и я знаю, как подключать методы, переопределять и все такое. Но теперь я хочу получить доступ к представлениям пользовательского интерфейса, объявленным в (@interface).

Вот заголовочный файл, на который я ссылаюсь:

@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 (например: UISwitch * alertSwitch;).

Как я могу получить к нему доступ? Пожалуйста, помогите, я пытаюсь понять это с трех дней :(. Любая помощь или предложение очень очень ценится.

1 Ответ

0 голосов
/ 12 марта 2020

Надеюсь, эта помощь

%hook SettingsViewController
-(void) WhereEverYouWantToRunYourCode {

      self.alertSwitch = ....

    }

    %end 
...