简体   繁体   English

当我的App运行时,如何以编程方式获取LIVE屏幕截图?

[英]How can I get a LIVE screenshot programmatically, when my App is running?

I just want to share a screen shoot of an UIView vie email, FB or what ever users want! 我只想分享UIView vie电子邮件,FB或任何用户想要的屏幕截图! The below code only takes a original of UIView with no inputed texts nor changed images 下面的代码仅采用UIView的原始版本,没有输入文本,也没有更改图像

CGRect rect = [mainView bounds];
    UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [mainView.layer renderInContext:context];
    UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

您应该能够使用此答案中的一种解决方案,具体取决于它是否是视网膜设备。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式确定我的应用程序正在iPhone,iPad或iPhone 4上运行? - How can I determine programmatically that my app is running on an iPhone, iPad or iPhone 4? 如何在我的应用未运行时处理推送通知 - how can I handle push notification when my app is not running 如何以编程方式制作iPhone桌面的屏幕截图? - How can I make a screenshot of iPhone desktop programmatically? 如何以编程方式确定我的应用程序是iPad还是iPhone - How can I programmatically determine if my app iPad or iPhone 当 iPhone 用户退出主屏幕或 App Switcher 时,如何让我的计时器继续运行? - How can I make my timer keep running when the iPhone user quits to the home screen or the App Switcher? 当我的iPhone应用程序运行时,如何在后台播放连续音乐? - How can I play continuous music in the background when my iPhone app is running? 如何让我的 Xamarin 应用程序在 iOS 设备上运行? - How do I get my Xamarin app running on an iOS device? 我的应用崩溃了iOS 5! Xcode / SDK仍为Beta时,如何获得iOS 5应用程序? - My app is crashing iOS 5! How can I get an iOS 5 app when Xcode/SDK is still beta? 如果当 iOS 应用程序在后台时 NSTimer 不起作用,我怎样才能让我的应用程序定期唤醒? - If NSTimer does not work when an iOS app is in the background, how can I get my app to wake up periodically? 如何检查我的iPhone应用程序在什么硬件上运行? - How can I check what hardware my iPhone app is running on?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM