0

嗯,我不能得到这个太工作。我的目标也是在 Minecraft 袖珍版中添加一个 UIButton。我认为这个问题很容易或很明显,所以请不要被小墙的代码所迷惑。

非常感谢, Kivifreak

#import <substrate.h>

 #import <UIKit/UIKit.h>

@interface Tpschanger

UIButton *myButton;

UIView *myView;

-(void) TPSButton;

@end

%hook minecraftpeViewController

-(void)viewDidLoad {

myView=[[UIView alloc]initWithFrame:CGRectMake(0,0,320,480)];

myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

myButton.frame = CGRectMake(20, 20, 200, 44);

[myButton setTitle:@"TPS" forState:UIControlStateNormal];

[myButton addTarget:self action:@selector(TPSButton:) forControlEvents:UIControlStateNormal];

[self.myView addSubview:myButton];  

> I get an error at the previous line: request for member ‘myView’ in ‘self’, which is of non-class type ‘minecraftpeViewController*’

%orig;

}

%new
-(void) TPSButton {

}

%end
4

1 回答 1

0

应该是[self.view addSubview:myButton];IMO,您不需要 myView。

于 2013-06-15T09:33:41.347 回答