从Springboard获取应用程序图标图像(越狱)

时间:2013-04-21 14:12:11

标签: iphone objective-c jailbreak theos logos

我正在使用theos开发锁屏应用程序,部分功能需要手机上某些应用程序的图标图像。如何获取这些图标图像并将其显示在手机的锁屏上?

到目前为止,我已经尝试了所有我能想到的东西,并且在没有运气的情况下搜索了跳板标题。我一直在尝试从我通过谷歌找到的建议中检索来自SBApplication和SBIconModel的图像,但我仍然没有运气。

非常感谢任何帮助。谢谢!

2 个答案:

答案 0 :(得分:5)

在您挂钩一个类之后,在您正在使用的方法中,如果您尝试获取邮件应用程序的图标,请执行以下操作

// Get the SBApplication for the mail app
Class $SBApplicationController = objc_getClass("SBApplicationController");
SBApplication *mailApp = [[$SBApplicationController sharedInstance] applicationWithDisplayIdentifier:@"com.apple.mobilemail"];

// Get the SBApplicationIcon for the mail app
SBApplicationIcon *mailAppIcon = [[objc_getClass("SBApplicationIcon") alloc] initWithApplication:mailApp];

重要的是获得您感兴趣的应用的正确DisplayIdentifier。

希望这有帮助!任何问题请大声喊。

答案 1 :(得分:0)

虽然我接受上述答案,但我最终使用以下代码,显示标题和徽章:

SBIcon *sbIcon = [model applicationIconForDisplayIdentifier:identifier];
SBIconView *app = [[%c(SBIconView) alloc] initWithDefaultSize];
[app setIcon:sbIcon];

//if you want the titles to be conditional
[app setLabelHidden:!titlesEnabled];

//if you want the badge view to be conditional
id badgeView;
if (device_version >= 6.0) badgeView = MSHookIvar<id>(app, "_accessoryView");
else badgeView = MSHookIvar<id>(app, "_badgeView");
if (badgeView) [badgeView setHidden:!badgesEnabled];
相关问题