[英]How to take screen shot in the app to a small frame by coding,iphone
[英]iPhone: how use NSTimer to hide UIButton and take screen shot
您好如何在隐藏UIButton后实现NSTimer进行屏幕截图,您能告诉我如何使用EXAMPLE实现它。 首先UIButton必须隐藏和屏幕截图必须采取屏幕有一个美好的一天
以下是如何获取窗口的屏幕截图:
http://fmwebschool.com/blog/2008/10/01/taking-screenshots-with-the-iphone-sdk/
对于其余的:
[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
}
}
要在给定时间截取屏幕特定部分的屏幕截图,请使用类似的内容
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();
在一个名为takePhoto的方法中包装所有这些,你可以使用NSTimer来触发
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(takePhoto:) userInfo:nil repeats:YES];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.