0

我是开发越狱 iphone 应用程序的新手。我想在锁屏上添加我自己的视图,例如按钮,并做一些简单的任务,但我不知道要使用什么 api 或函数。我可以通过使用特殊模板来做到这一点(比如编写自定义通知小部件)吗?或者在特定视图上添加子视图?

4

1 回答 1

0

这是我的徽标代码:

#import <UIKit/UIKit.h>
#import <SpringBoard/SBAwayController.h>
%hook SBAwayController
- (void)lock
{
    %orig;

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(10, 100, 280, 50);
    [btn setTitle:@"Hello Notification" forState:UIControlStateNormal];
    UITapGestureRecognizer *singleTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(unlock)] autorelease];
    [btn addGestureRecognizer:singleTap];
    [[[objc_getClass("SBAwayController") sharedAwayController] awayView] addSubview:btn];

    return;
}
%end

当我锁定屏幕时,按钮被添加到锁定屏幕。

于 2012-11-21T05:56:00.813 回答