0

我得到“没有找到'-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
4

1 回答 1

1

消息被称为addSubview:,不是addSubView:

[[ui window] addSubview:myButton];
于 2012-08-31T01:05:02.980 回答