I created a custom UIView programmatically. Does anyone know what class and what method I would use to display this on the springboard? I want my UIView to display on the springboard, and when a user opens an app I want it to show up there too. I have been searching through the private headers for some time and I can't seem to find what I'm looking for. I am developing a jailbreak tweak with iosopendev. Also could you tell me if the class is a viewcontroller or just a view?
问问题
1729 次
2 回答
2
如果您希望 UIView 显示在任何地方(在 SpringBoard 和应用程序中),您应该在其他 UIWindow 上方创建一个新的 UIWindow 并在其中显示您的视图,如下所示:
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.windowLevel = UIWindowLevelAlert + 2;
[window setHidden:NO];
[window setAlpha:1.0];
[window setBackgroundColor:[UIColor clearColor]];
[window addSubview:yourView];
于 2014-05-07T16:36:28.117 回答
0
您可以挂钩 SpringBoard 的一些方法,例如:
- (void)applicationDidFinishLaunching:(id)arg1
然后,您的代码应该是这样的:
- (void)applicationDidFinishLaunching:(id)arg1
{
%orig;
NSLog(@"----- applicationDidFinishLaunching -----");
UIWindow *_uiwindow = [[UIWindow alloc] initWithFrame:CGRectMake(100,100,120,100)];
_uiwindow.windowLevel = UIWindowLevelStatusBar;
_uiwindow.hidden = NO;
[_uiwindow setBackgroundColor:[UIColor redColor]];
}
要添加更多自定义视图,只需将子视图添加到_uiwindow
. 希望对您有所帮助。
于 2015-05-22T02:05:39.547 回答