Wallpaper
From iPhone Development Wiki
Explain wallpapers
Get a UIImage
#import <UIKit/UIKit.h> @interface SBWallpaperView : UIImageView + (id)_desktopImage; // iOS 3 - (id)initWithOrientation:(UIImageOrientation)orientation; // iOS 4 - (id)initWithOrientation:(UIImageOrientation)orientation variant:(NSInteger)variant; // iOS 5-6 @end @interface SBWallpaperController : NSObject + (id)sharedInstance; - (SBFStaticWallpaperView *)_wallpaperViewForVariant:(NSInteger)variant; @end @interface SBFWallpaperView : UIView @end @interface SBFStaticWallpaperView : SBFWallpaperView - (UIImage *)wallpaperImage; @end UIImage *wallpaperForVariant(NSInteger variant) { UIImage *img = nil; if (kCFCoreFoundationVersionNumber <= 500.0) { // iOS 3 SBWallpaperView *wallpaperView = [objc_getClass("SBWallpaperView") _desktopImage]; img = [[wallpaperView.image copy] autorelease]; [wallpaperView release]; } else if (kCFCoreFoundationVersionNumber <= 600.0) { // iOS 4 SBWallpaperView *wallpaperView = [[objc_getClass("SBWallpaperView") alloc] initWithOrientation:UIImageOrientationUp]; img = [[wallpaperView.image copy] autorelease]; [wallpaperView release]; } else if (kCFCoreFoundationVersionNumber <= 800.0) { // iOS 5-6 SBWallpaperView *wallpaperView = [[objc_getClass("SBWallpaperView") alloc] initWithOrientation:UIImageOrientationUp variant:variant]; img = [[wallpaperView.image copy] autorelease]; [wallpaperView release]; } else { // iOS 7+ SBFStaticWallpaperView *wallpaperView = [[objc_getClass("SBWallpaperController") sharedInstance] _wallpaperViewForVariant:variant]; img = [[wallpaperView.wallpaperImage copy] autorelease]; } return img; }
Note: code for iOS 3-4 versions were not tested and built from header comprehension. For example, on iOS 4, -(id)uncomposedImage could be providing the real image while the .image property is the composed wallpaper