我得到“没有找到'-addSubView'方法”
当我尝试将子视图添加到窗口时,在这种情况下尝试添加按钮。这是我的代码
@interface SBUIController
-(id)window;
@end
@interface SBAwayView
-(void)chargingView;
-(void)showChargingView;
-(void)hideChargingView;
-(void)showBulletinView;
-(BOOL)shouldShowChargingView;
-(void)hideCameraButton;
@end
%hook SBAwayController
-(void)_tearDownCameraPreview{
//SBAwayView *v = MSHookIvar<id>(self, //"_awayView");
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; myButton.frame = CGRectMake(21, 80, 100, 35); [myButton setTitle:@"My Button" forState:UIControlStateNormal];
SBUIController *ui = MSHookIvar<id>(self, "_uiController");
[[ui window] addSubView:myButton];
%orig; }
%end