开发者

How to get status bar images in iPhone APP

开发者 https://www.devze.com 2023-01-12 21:15 出处:网络
I want to get status bar images without UIGetScreenImage() because this method is Private API. Apple recommend

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 stat开发者_StackOverflow中文版us 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
0

精彩评论

暂无评论...
验证码 换一张
取 消