[英]iPhone: how use NSTimer to hide UIButton and take screen shot
[英]How to take screen shot in the app to a small frame by coding,iphone
我想在应用程序中进行屏幕截图,然后在下一个视图中使用该图像。 有没有办法让我们可以在应用程序中拍摄视图的屏幕快照,然后使用该图像。
提前谢谢了
加根乔希
试试这个
#import <QuartzCore/QuartzCore.h>
@property (retain, nonatomic) IBOutlet UIImageView *imageView;
-(UIImage*)getShot
{
UIGraphicsBeginImageContext(CGSizeMake(320, 460));
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
希望这会帮助您使用iPhone和iPad
捕获iPhone应用程序的屏幕截图
#import <QuartzCore/QuartzCore.h>
-(UIImage*)captureImage
{
UIGraphicsBeginImageContext(CGSizeMake(320, 460));
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
容易做到(假设self是UIViewController ):
#import < QuartzCore/QuartzCore.h >
...
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
现在,您可以将屏幕快照包含在可变屏幕快照中 ,并将其放入UIImageView中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.