显示UIButton不工作iOS 7崩溃设备

时间:2014-04-18 20:29:12

标签: objective-c uibutton theos logos

我的代码出了什么问题?我对整个越狱开发过程有些新意。如果有人可以帮我这个。我试图对我学到的新东西进行测试,我试图在主屏幕上显示一个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

1 个答案:

答案 0 :(得分:0)

@selector(myButtonPressed)

简单地添加:按下我的按钮后,它变为

@selector(myButtonPressed:)