制作“照片库”的最佳方法应用程序

发布于 2024-11-04 07:49:59 字数 154 浏览 2 评论 0原文

我真的很想尝试制作一个可以存储照片并受密码保护的应用程序,就像其他应用程序一样。 IE。只有我的眼睛,等等。我不会要求这里的任何人给我一步一步的指导如何制作一个(不过会很好;)。我要问的是我应该从哪里开始?我想使用分割视图控制器,并且我一直在努力让它们发挥作用。提前致谢,

泰特

I really wanted to try to make an app that stores photos and is password protected, much like the other apps out there. IE. My eyes only, etc. I am not asking anyone here to give me step by step instructions on how to make one (would be nice though ;). What I am asking is where should I even begin? I would like to use the split view controller, and Ive been trying to get those to work. Thanks in advance,

Tate

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏日落 2024-11-11 07:50:00

从高层次来看......这里有一些我会考虑的项目......

你将在哪里存储图像?服务器,本地?
如果是本地的,您将在哪里存储图像? IOS 照片库或您的应用程序目录?

接下来,您将如何显示图像?
iphone没有开箱即用的多列多行照片缩略图查看器(我知道)..因此你需要根据 UIScrollView 滚动你自己的

我也希望能够从图像分页到全屏模式下的图像,这也可以通过启用分页的 UIScrollView 来完成,每个页面都包含另一个包含图像视图的 UIScrollView(用于缩放和平移)。

我的清单上的下一个是内存管理。如果我在页面上显示多个图像,我无法渲染原始图像,也不会加载它们,因此每个图像都需要渲染和存储缩略图。关于调整图像大小有很好的代码。

接下来是捕获图像的问题。UIImagePickerController 将是您的控制器。

接下来是密码的问题。如果您半认真地想要保护它..将其存储在钥匙串中是您的选择。如果它只是一个简单的 pin 并且谁真正关心它是否被黑客攻击..那么只需将其存储在 NSUserDefaults 中即可。

这是读取 doc 目录图像的代码

                NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
                NSString *docDir = [paths objectAtIndex:0];
                NSString *path = [[NSString alloc]initWithFormat: @"%@/%@",docDir,name];

                NSMutableData *data = [[NSMutableData alloc] initWithContentsOfFile:path];

                if(data)
                {
                    image = [UIImage imageWithData:data];   
                }

                [data release];
                [path release];

,从这里开始,我确信您还可以做很多事情......但这至少是一个很好的起点。

from a high level.. here are some items I would think about...

where will you store the images? Server, Local?
if local, where you will you store the images? IOS Photo Library or your app directory?

next, how will you display the images?
iphone does not have a multi-column multi row photo thumbnail viewer out of the box (that Im aware of).. hence you will need to roll you own based on a UIScrollView

I would also want to have the ability to page from image to image in full screen mode, that too would be done with a UIScrollView, paging enabled,each page holding another UIScrollView (for zooming and panning) that holds the imageview.

next on my list would be memory management. if Im showing multiple images on page, there is no way I could render the original images, nor would I care to load them, so each image would need to have a thumbnail rendered and stored. there is good code out there on resizing an image.

next is the issue of capturing the image.. the UIImagePickerController will be your controller there.

next is the issue of the password. If you are semi serious about protecting it.. storing it in the keychain is your choice. If its just a simple pin and who really cares if its hacked.. then just store it in NSUserDefaults.

here is the code to read an image for your doc directory

                NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
                NSString *docDir = [paths objectAtIndex:0];
                NSString *path = [[NSString alloc]initWithFormat: @"%@/%@",docDir,name];

                NSMutableData *data = [[NSMutableData alloc] initWithContentsOfFile:path];

                if(data)
                {
                    image = [UIImage imageWithData:data];   
                }

                [data release];
                [path release];

and from here, Im sure there is a ton more you could do.. but its at least a good starting point.

各自安好 2024-11-11 07:50:00

与任何较大的项目一样,我建议您从较小的示例开始,然后逐步完善。例如,尝试构建以下小型应用程序:

  • 需要安全密码才能访问(或在用户切换回应用程序或屏幕超时时返回!)
  • 存储照片
  • 允许用户设置不同的类别
  • 以美观的方式显示照片例如缩略图、捏合缩放、幻灯片
  • 探索分割视图控制器

一旦您在迷你应用程序上尝试了所有这些想法,您将对如何构建更大的 [pr0n-storing ;)] 图像有更好的想法应用程序...

Like any bigger project, I'd suggest you start with smaller examples and then work up. For example, try building small apps that:

  • Require a security password to access (or to return to if the user swaps back to the app or the screen times out!)
  • Store photos
  • Allow users to set up different categories
  • Display photos in a nice way eg thumbnails, pinch-and-zoom, slideshow
  • explore split-view controllers

Once you have tried out all these ideas on mini-apps, you'll have a much better idea on how to build your larger [pr0n-storing ;)] image app...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文