2010-12-19 10 views

Antwort

1

Um einen Screenshot eines bestimmten Abschnitts des Bildschirms zu einem bestimmten Zeitpunkt zu erstellen, verwenden Sie bitte Folgendes:

CGRect screenRect = CGRectMake(0, 0, 200, 200); 
UIGraphicsBeginImageContext(screenRect.size); 

CGContextRef ctx = UIGraphicsGetCurrentContext(); 
CGContextFillRect(ctx, screenRect); 
//you probably need an offset, adjust here 
CGContextTranslateCTM(ctx, -20, -20); 
[self.view.layer renderInContext:ctx]; 

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 

//if you want to save this image to the photo album uncomment the next line 
//UIImageWriteToSavedPhotosAlbum(newImage, nil, nil, nil); 
UIGraphicsEndImageContext(); 

Wrap all dies oben in einem Verfahren namens takePhoto und man kann einfach NSTimer

[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(takePhoto:) userInfo:nil repeats:YES]; 
+0

Danke dir, das hilft mir –

3

Hier ist, wie ein Screenshot von Ihrem Fenster nehmen:

http://fmwebschool.com/blog/2008/10/01/taking-screenshots-with-the-iphone-sdk/

Für den Rest:

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(count) userInfo:nil repeats:YES]; 

- (void)count { 
counter++; 
if (counter == secondsToWait) { 
button.alpha = 0; 
//Take Screenshot here 
} 
} 
+0

hallo dankt Ihnen dabei helfen mir viel zu triggern verwenden, gibt es eine Methode Screenshot für bestimmten Bereich zu nehmen, was wir spezifizieren den Bereich des Bildschirms –

Verwandte Themen