简体   繁体   中英

How to get status bar images in iPhone APP

I want to get status bar images without UIGetScreenImage() because this method is Private API.

Apple recommend

http://developer.apple.com/iphone/library/qa/qa2010/qa1703.html

as a alternate solution, but this way can't get status bar images.

Would like to know how to get status bar images?

This is impossible without using the Private API.

Referencing this duplicate: Emailing full screen of iPhone app

CGImageRef UIGetScreenImage();
@interface UIImage (ScreenImage)
+ (UIImage *)imageWithScreenContents;
@end

@implementation UIImage (ScreenImage)
+ (UIImage *)imageWithScreenContents
{
    CGImageRef cgScreen = UIGetScreenImage();
    if (cgScreen) {
        UIImage *result = [UIImage imageWithCGImage:cgScreen];
        CGImageRelease(cgScreen);
        return result;
    }
    return nil;
}
@end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM