iOS-向图像添加kCGImagePropertyExifUserComment的问题 [英] iOS - Issues adding kCGImagePropertyExifUserComment to image

查看:99
本文介绍了iOS-向图像添加kCGImagePropertyExifUserComment的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将kCGImagePropertyExifUserComment写入图像时遇到问题.我的代码(整体)有效,因为它可以轻松编写GPS坐标.但是,在UserComment字段中写一些其他信息是行不通的(我不确定为什么).代码是:

I'm having problems writing a kCGImagePropertyExifUserComment to my image. My code (overall) works, as it writes GPS coordinates without a hassle. However, writing some additional info in the UserComment field is non-working (and I'm not sure why). Code is:

CFDictionarySetValue(mutable, kCGImagePropertyExifUserComment, [NSString stringWithFormat:@"%0.0f,%0.0f,%0.0f",yaw,pitch,roll]);

有人对此有想法吗?

推荐答案

如果其他人想知道如何做到这一点,我终于想通了:

If anyone else is wondering how to do this, I've finally figured it out:

NSDictionary *etcDict=[NSDictionary dictionaryWithObjectsAndKeys:
                               [NSString stringWithFormat:@"%0.0f,%0.0f,%0.0f",yaw,pitch,roll],kCGImagePropertyExifUserComment,
                               nil];
CFDictionarySetValue(mutable, kCGImagePropertyExifDictionary, etcDict);

奇怪,但是效果很好!

这篇关于iOS-向图像添加kCGImagePropertyExifUserComment的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆