我正在对 iPhone 进行调整,将在关机滑块下方放置一个复位滑块。我找到了合适的类,我已经覆盖了它,并且我设法插入了一个按钮,单击该按钮可以重新启动设备。但是,我需要用“滑动重新启动”栏替换该按钮,就像上面的“滑动关闭电源”一样。我怎样才能做到这一点?提前致谢!:)
编辑:这是我的源代码:
#import "substrate.h"
#import <UIKit/UIKit.h>
@interface MultiBar
-(void)action;
@end
static UIButton *button;
static UIView *lockView;
%hook SBPowerDownView
-(void)finishedAnimatingIn
{
lockView = MSHookIvar<UIView *>(self, "_dimView");
button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
[button addTarget:self action:@selector(action) forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Respring" forState:UIControlStateNormal];
button.frame = CGRectMake(80,100,160,40);
[lockView addSubview:button];
[button release];
%orig;
}
%new(v@:)
-(void)action
{
[[UIApplication sharedApplication] relaunchSpringBoard];
}
%end