有人能告诉我如何挂钩SpringBoard方法吗,就像一些AppSlider方法与iOsOpenDev (IOS7.1)一样。而且,我也不知道我要采取什么框架。
我试过了,但控制台上什么也没有出现:
import UIKit/UIKit.h
import SpringBoard/SpringBoard.h
import "CaptainHook.h"
CHDeclareClass(SBAppSliderScrollingViewController);
CHOptimizedMethod(0, self, void, SBAppSliderScrollingViewController, loadView)
{
CHSuper(0, SBAppSliderScrollingViewController, loadView);
NSLog(@"Ciccia!");
}
CHConstructor
{
@autoreleasepool
{
CHLoadLateClass(SBAppSliderScrollingViewController);
CHHook(0, SBAppSliderScrollingViewController, loadView);
}
}发布于 2014-06-27 14:06:26
你为什么要
CHLoadLateClass(SBAppSliderScrollingViewController); //for class available later你可以直接写
CHLoadClass(SBAppSliderScrollingViewController);//for class available now ;)你可以很容易地用徽标..。举个例子..。
#import <UIKit/UIKit.h>
%hook SBAppSliderController
- (void)loadView {
%orig;
NSLog (@"****AppSwitcher Appeared");
UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:@"Test"
message:@"app switcher appeared."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[testAlert show];
[testAlert release]; //for non-arc
}
%end注意:如果需要在SBAppSliderController出现时执行某些操作,则正确的类是AppSwitcher ;)
https://stackoverflow.com/questions/24451167
复制相似问题