0

I am new to develop jailbroaken iphone apps. I'd like to add my own views, such as button, on the lockscreen and do some simple tasks, but i have no idea what api or function to use. Can I do that by using a special template(like writing custom notification widget)? Or add subviews on a specific view?

James Ye
  • 107
  • 7
  • 1
    Have you [looked at this question yet](http://stackoverflow.com/a/11602574/119114)? It's generally good information to familiarize yourself with, for these kinds of tweaks. – Nate Sep 20 '12 at 05:24
  • Thanks a lot. That should work. I already dumped the Springboard headers and now I'm working on finding the classes which control the lock screen. – James Ye Sep 20 '12 at 06:46

1 Answers1

0

this is my logos code:

#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

when I lock the screen, the button is added to the lockscreen.

James Ye
  • 107
  • 7