Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-15-2009, 07:55 PM   #34 (permalink)
NewiPhoneDeveloper
Registered Member
 
Join Date: Jul 2008
Posts: 459
NewiPhoneDeveloper is on a distinguished road
Default

Quote:
Originally Posted by justill45 View Post
yeah, i didnt see the second page of this thread, but yeah, pretty cool. Is there any place i can see how to use this method?
I think the following should work (untested):

In your AppDelegate.m or any other .m where you want to use this feature, add the following lines of code right below the #import section:

Code:
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
Now you can grab the screen like that:
Code:
- (void)grabScreen {
    CGImageRef screen = UIGetScreenImage();
    UIImage *screenImage = [UIImage imageWithCGImage:screen];
    //now save your image or do with it whatever you like
}
__________________
Websites:
Friendlydeveloper - Coding Blog
Codingsessions - Live iOS Training

iPhone Apps:
TextPal - Powerful group messaging,
icePhone

Find me on LinkedIn
NewiPhoneDeveloper is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,415
Threads: 94,015
Posts: 402,526
Top Poster: BrianSlick (7,978)
Welcome to our newest member, deannme48
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:11 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.