- ( void ) imageSaved: ( UIImage *) image didFinishSavingWithError:( NSError *)error
contextInfo: ( void *) contextInfo
{
NSLog(@"保存结束");
if (error != nil) {
NSLog(@"有错误");
}
}
void _SavePhoto(char *readAddr)
{
NSString *strReadAddr = [NSString stringWithUTF8String:readAddr];
UIImage *img = [UIImage imageWithContentsOfFile:strReadAddr];
NSLog([NSString stringWithFormat:@"w:%f, h:%f", img.size.width, img.size.height]);
PhotoManager *instance = [PhotoManager alloc];
UIImageWriteToSavedPhotosAlbum(img, instance,
@selector(imageSaved:didFinishSavingWithError:contextInfo:), nil);
}
using UnityEngine;
using System.Runtime.InteropServices; public class TestSavePhoto : MonoBehaviour
{
[DllImport("__Internal")]
private static extern void _SavePhoto(string readAddr); private string _cptrAddr; private void OnGUI()
{
if (GUILayout.Button("_SavePhoto!", GUILayout.Height(), GUILayout.Width()))
{
Debug.Log("_SavePhoto");
var readAddr = Application.persistentDataPath + "/" + _cptrAddr;
_SavePhoto(readAddr);
}
if (GUILayout.Button("TakePhoto", GUILayout.Height(), GUILayout.Width()))
{
Debug.Log("TakePhoto");
var cptrAddr = "testpic"; //捕捉地址
var readAddr = Application.persistentDataPath + "/" + cptrAddr;//读取地址,这两个地址在iOS里不一样
Debug.Log("cptr:" + cptrAddr + ", read:" + readAddr);
Application.CaptureScreenshot(cptrAddr);
_cptrAddr = cptrAddr;
}
}
}

Unity3d 屏幕截图。并保存。iOS的更多相关文章

  1. Unity3D 调用Android与IOS的剪贴板

    Unity3D剪贴板 最近遇到一个需要调用Android与IOS设备本身剪贴板的需求,就是在Unity中,要将文本复制到设备本身的剪贴板中,然后在其他应用程序中都能粘贴. 最开始在网上查到的方式是使用 ...

  2. unity3d使用脚本保存屏幕截图

    using UnityEngine; using System.Collections; using System.IO; public class FrameAnimation : MonoBeha ...

  3. Unity3d+Jenkins 自动编译iOS、Android版本

    1.在Unity3d中, 创建导出 iOS.Android 项目脚本 PerformBuild.cs ,放在Editor目录下(必须),如下: using UnityEditor; using Sys ...

  4. Unity3d 截屏保存到相册,并且刷新相册

    要做一个截图的功能,并且玩家可以在相册中看到. 做的时候遇到了三个问题: 1.unity自带的截图API,Application.CaptureScreenshot在Android上不生效 2.图片保 ...

  5. 如何通过ShareSDK的 Unity3D快速接入Android/iOS分享与授权

    Unity3D是由Unity Technologies开发的一个让玩家轻松创建诸如三维视频游戏.建筑可视化.实时三维动画等类型互动内容的多平台的综合型游戏开发工具,是一个全面整合的专业游戏引擎:在游戏 ...

  6. Unity3d利用opencv保存游戏视频

    脚本MyVideoWriter.cs using UnityEngine; using System.Collections; using OpenCvSharp; using OpenCvSharp ...

  7. unity3D 搞定任意ios插件

    原地址:http://www.cnblogs.com/U-tansuo/archive/2012/11/22/unity_ios-plugin.html 说起unity调ios插件,好多淫比较头痛,探 ...

  8. Unity3D开发之“获取IOS设备所在的国家代码"

    原地址:http://dong2008hong.blog.163.com/blog/static/469688272014021025578/ 在前一段时间游戏开发中需要实现获取IOS设备所在的国家代 ...

  9. swift3.0 屏幕截图并且保存到本地相册

    所要截取的对象 var bg_view: UIView! 截取并且保存的代码如下 UIGraphicsBeginImageContextWithOptions(bg_view.frame.size, ...

随机推荐

  1. react-router 从 v2/v3 to v4 迁移(翻译)

    react-router v4 是完全重写的,所以没有简单的迁移方式,这份指南将为您提供一些步骤,以帮助您了解如何升级应用程序. 注意: 这份迁移指南适用于react-router v2和v3,但为简 ...

  2. Oracle Applications Documentation

    Oracle E-Business Suite Documentation Web Library Release 12.2+ Link Download Oracle E-Business Suit ...

  3. Ioc:The basic pattern for integrating Autofac into your application

    The basic pattern for integrating Autofac into your application is: Structure your app with inversio ...

  4. Android应用icon和闪屏splash的尺寸

    icon (尺寸为px) 目录 尺寸 (width * height) drawable 72 x 72 drawable-hdpi 72 x 72 drawable-ldpi 36 x 36 dra ...

  5. 选中TreeView的某节点,并加背景颜色

    一:按钮事件,遍历所有节点 private void button2_Click(object sender, EventArgs e) { foreach (TreeNode n in TreeVi ...

  6. Orchard模块开发全接触6:自定义用户注册

    我们都知道 Orchard 的用户注册相当简单,现在,我们需要一个自定义的用户注册,现在,开始吧. 一:定义实体 Models/CustomerPartRecord.cs: public class ...

  7. Orchard模块开发全接触5:深度改造前台第二部分

    在这一部分,我们继续完善我们的购物车,我们要做以下一些事情: 1:完成 shoppingcart.cshtml: 2:让用户可以更新数量及从购物车删除商品: 3:创建一个 widget,在上面可以看到 ...

  8. Unicode 和 UTF-8 的区别

    作者:于洋链接:https://www.zhihu.com/question/23374078/answer/69732605来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...

  9. String hashCode 方法为什么选择数字31作为乘子

    1. 背景 某天,我在写代码的时候,无意中点开了 String hashCode 方法.然后大致看了一下 hashCode 的实现,发现并不是很复杂.但是我从源码中发现了一个奇怪的数字,也就是本文的主 ...

  10. [leetcode]ZigZag Conversion @ Python

    原题地址:https://oj.leetcode.com/problems/zigzag-conversion/ 题意: The string "PAYPALISHIRING" i ...