核心数据和摄像机的问题 [英] Question regarding core data and the camera

查看:117
本文介绍了核心数据和摄像机的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在开发一个应用程序,它使用核心数据来存储用户可以设置的对象的属性。我主要集中在第一部分,这是设置一切在核心数据方面,现在我准备进入下一部分处理相机。我想要能够添加城市或其他地理位置(这是对象),然后能够在我的应用程序内拍摄照片,从而将这些照片(或属性)存储在对象下面。当我在我的uitableview点击纽约的例子,我可以看到我在纽约拍摄的任何数量的照片。当我点击佛罗里达州,我可以看到我在佛罗里达州拍摄的照片。所以,我的问题是关于这是否是一种可能性?对不起,这是一个含糊的问题。如果我是从我的应用程序拍照,我能够保存他们在那里吗?并在我的应用程序中列出他们的列表?我想我正在想象一个独立的核心数据类似的视图使用place对象让你管理图片,使他们可以直接查看像幻灯片模式,我可以看到我在该位置拍摄的所有图片。这是一种可能性还是他们会保存在图片应用程序中的默认图片位置?会有可能有任何内存限制吗?或者我可以从媒体内存(8gb,16gb等)拉?我想我的问题不是为具体的代码示例,因为它们是为方向的目的。如果任何人有任何见解/想法,以帮助我,将非常感谢。谢谢!

So I am working on an app that uses core data to store attributes of objects that the user can set. I have primarily been focusing on the first part, which was setting everything up on the core data side, and now I am ready to move on to the next part which deals with the camera. I want to be able to add a city, or other geographical location (this is the object) and then be able to take pictures within my application that would accordingly store these pictures (or attributes) under the object. When I click on New York on my uitableview for example, I'd be able to view any number of pics that I took in NY. When I click on Florida, I'd be able to view any pics I took in Florida. So, my question is about whether or not that is a possibility? Sorry, that was a vague question. If I were to take pictures from within my app, would I be able to save them there as well? And make a list of them in my app? I guess I am envisioning a seperate core data-esque looking uitableview withing the place object letting you manage pictures so that they are directly viewable in like a slide show mode where I'd be able to see all the pictures I took at that location. Is that a possibility or would they save in the default picture location in the pictures app? Would there conceivably be any memory restrictions? Or would I be able to pull from the media memory (8gb, 16gb, etc)? I guess my questions aren't for specific code examples as much as they are for directional purposes. If anyone has any insights/ideas to help me out it would be greatly appreciated. Thanks!

推荐答案

您描述的设计是绝对可能的。

The design you describe is definitely possible.

您可以让用户有机会从照片库中选择照片(和/或视频),和/或使用相机拍摄新照片,然后在应用中使用/编辑/存储。查看 UIImagePickerController UIImagePickerControllerDelegate 协议。

You can give users the opportunity to select a picture (and/or video) from their photo library and/or take a new one with the camera and then use/edit/store it in your application. Check out the UIImagePickerController and the UIImagePickerControllerDelegate protocol.

您可以使用 UIImagePNGRepresentation()或<$ c将图像直接存储在Core Data中作为可转换属性$ c> UIImageJPEGRepresentation()。如果这样做,建议您使用图像数据属性创建一个单独的实体,以便您可以快速加载其他属性(并且只根据需要拉入关系中的图像数据)。或者,您可以将图片存储在应用的Documents目录中的文件中,并将文件名保存为实体中的属性。

You can store images directly in Core Data as a transformable attribute by converting them to NSData using UIImagePNGRepresentation() or UIImageJPEGRepresentation(). If you do this, it is recommended that you create a separate entity with the image data attribute so that you can load your other attributes quickly (and only pull in the image data across the relationship as needed). Alternatively, you can store the images in files in your app's Documents directory and save the filename as an attribute in your entity.

查看 TTThumbsViewController 中的 Three20库,以便显示网格的照片缩略图。

Check out the TTThumbsViewController in the Three20 library for a nice way to show a grid of photo thumbnails.

这篇关于核心数据和摄像机的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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