0

我的代码有什么问题??我对整个越狱开发过程有些陌生。如果有人可以帮助我解决这个问题。我试图对我学到的新东西进行测试,并且我试图在主屏幕上显示一个 UIButton 来创建一个 UIAlertView。

%hook SBUIController
- (void)finishLaunching
{
UIButton *myButton;
    myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    myButton.frame = CGRectMake(25, 85, 100, 35);
    [myButton setTitle:@"Test" forState: UIControlStateNormal];
    [myButton addTarget:self action:@selector(myButtonPressed) forControlEvents:UIControlEventTouchUpInside];

SBUIController *ui = MSHookIvar<id>(self, "_uiController");
    [[ui window] addSubview:myButton];
}

%new(v@:)
-(void)myButtonPressed{

UIAlertView *theAlert = [[UIAlertView alloc] initWithTitle:@"Title of Alert"      message:@"Message of Alert" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK",  nil];
[theAlert show];
[theAlert release];

}

%end
4

1 回答 1

0

@selector(myButtonPressed)

只需添加:按下我的按钮后,它就变成了

@selector(myButtonPressed:)

于 2014-09-16T19:33:17.460 回答