以编程方式设置iOS背景/锁屏图像? [英] Setting iOS background/lockscreen image programmatically?
问题描述
我希望能够以编程方式设置锁屏背景图像.我知道这仅适用于越狱的iOS设备.
I'd like to be able to set the lockscreen background image programmatically. I'm aware that this is only possible for jailbroken iOS devices.
以下是我尝试过的一些事情:
Here are some things that I've tried:
-
将LockBackground.png放在/private/var/mobile/Library/SpringBoard/中.这行得通,但需要艰苦的努力.
notify_post("com.apple.language.changed");
不适用于软弹跳.
使用class-dump
转储UIKit的私有方法. 4.2中的UIKit曾经有一种称为+ (void)setDesktopImageData:(id)fp8;
的方法,但在4.3及更高版本中似乎缺少.
Use class-dump
to dump private methods of UIKit. UIKit in 4.2 used to have a method called + (void)setDesktopImageData:(id)fp8;
but it appears to be missing in 4.3 and above.
有什么我想念的吗?
推荐答案
我在SpringBoard转储中发现了这一点,我认为这对您有用:
I found this in the SpringBoard dump which I think will be of use to you:
在SBWallpaperView.h中:
In SBWallpaperView.h:
- (void)replaceWallpaperWithImage:(id)image;
在SBUIController.h中:
And in SBUIController.h:
- (id)wallpaperView;
因此您可以执行以下操作:
So you can do something like:
[(SBWallpaperView *)[SBUIController sharedInstance] wallpaperView] replaceWallpaperWithImage:anImage];
那是一种方式.
我发现的另一个方法是使用SBWallpaperView的+ (void)noteWallpaperPreferencesChanged;
,对此我不太确定,但是好像您在尝试的第一件事中做的一样,然后使用它代替了重新出现,它可能会起作用.
The other one I found was to use SBWallpaperView's + (void)noteWallpaperPreferencesChanged;
, I'm not that sure about this one, but it seems like if you do what you did in the first thing you tried, and then use this instead of a respring, it might work.
这篇关于以编程方式设置iOS背景/锁屏图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!