Best way to make a "Photo Vault" app
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. Tha开发者_运维百科nks in advance,
Tate
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.
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...
精彩评论