【问题标题】:Is possible PrintScreen or save in an image some part of the screen?是否可以 PrintScreen 或将屏幕的某些部分保存在图像中?
【发布时间】:2012-01-19 13:54:47
【问题描述】:

有可能吗?我需要保存屏幕并从 iPad 发送到 WebService...具体的问题是我想在屏幕上模拟一个标志,然后将此标志保存在 NSData 中并通过电子邮件发送。

有什么想法吗?

谢谢大家!

最好的问候!

【问题讨论】:

    标签: iphone xcode image sign printscreen


    【解决方案1】:
    UIView *view = ...; // Get root view of current view controller
    
    UIGraphicsBeginImageContext(view.bounds.size);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    NSData *imageData = UIImagePNGRepresentation(viewImage);
    

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 1970-01-01
      • 2021-09-21
      • 1970-01-01
      • 1970-01-01
      • 2021-08-24
      • 2012-12-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多