以编程方式设置iOS背景/锁屏图像?

时间:2021-09-19 10:55:17

I'd like to be able to set the lockscreen background image programatically. I'm aware that this is only possible for jailbroken iOS devices.

我希望能够以编程方式设置锁屏背景图像。我知道这只适用于越狱的iOS设备。

Here are some things that I've tried:

以下是我尝试过的一些事情:

  1. Place a LockBackground.png in /private/var/mobile/Library/SpringBoard/. This works but requires a hard respring. notify_post("com.apple.language.changed"); doesn't work for a soft respring.

    将LockBackground.png放在/ private / var / mobile / Library / SpringBoard /中。这有效,但需要坚硬的响应。 notify_post( “com.apple.language.changed”);不适用于柔软的呼吸。

  2. 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.

    使用class-dump转储UIKit的私有方法。 4.2中的UIKit曾经有一个名为+(void)的方法setDesktopImageData:(id)fp8;但它似乎在4.3及以上版本中缺失。

Is there anything that I'm missing?

有什么我想念的吗?

1 个解决方案

#1


11  

I found this in the SpringBoard dump which I think will be of use to you:

我在SpringBoard转储中找到了这个,我觉得它对你有用:

In SBWallpaperView.h:

- (void)replaceWallpaperWithImage:(id)image;

And in SBUIController.h:

在SBUIController.h中:

- (id)wallpaperView;

So you can do something like:

所以你可以这样做:

[(SBWallpaperView *)[SBUIController sharedInstance] wallpaperView] replaceWallpaperWithImage:anImage];

That's one way.

这是一种方式。

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.

我找到的另一个是使用SBWallpaperView的+(void)noteWallpaperPreferencesChanged;,我对这个不太确定,但看起来如果你做了你在尝试的第一件事中做了什么,然后用它来代替一个呼吁,它可能会奏效。

#1


11  

I found this in the SpringBoard dump which I think will be of use to you:

我在SpringBoard转储中找到了这个,我觉得它对你有用:

In SBWallpaperView.h:

- (void)replaceWallpaperWithImage:(id)image;

And in SBUIController.h:

在SBUIController.h中:

- (id)wallpaperView;

So you can do something like:

所以你可以这样做:

[(SBWallpaperView *)[SBUIController sharedInstance] wallpaperView] replaceWallpaperWithImage:anImage];

That's one way.

这是一种方式。

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.

我找到的另一个是使用SBWallpaperView的+(void)noteWallpaperPreferencesChanged;,我对这个不太确定,但看起来如果你做了你在尝试的第一件事中做了什么,然后用它来代替一个呼吁,它可能会奏效。