Voices That Matter

Data / File Management

iPhone Developer Tips Stats:
Past 30 days - Pageviews: 88,424 Visitors: 61,675
Thank you everyone! Let's shoot for 100,000 by May. Pass it on...



Save UIImage Object as a PNG or JPEG File

In an earlier post on saving images from the camera to the Photo Album, a question was posed asking how to save the image to another directory other than the Photo Album. Let’s walk through one way to write a UIImage object, from the camera or otherwise, as a PNG or JPG file into the [...]

Data / File Management

Read and Write Array, Dictionary and Other Collections to Files

With just a few lines of code, you can read/write collections to/from files. The code below shows examples for writing and reading back both arrays and dictionaries.
Read and Write Collections to File

NSArray *array = [NSArray arrayWithObjects:
@"Hefeweizen", @"IPA", @"Pilsner", @"Stout", nil];
 
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
array, @"array", @"Stout", @"dark", @"Hefeweizen", [...]

Data / File Management

Reading a plist into an NSArray

Reading a plist into an NSArray
This is the second tip in a series of four that is based on content from the O’Reilly book Head First iPhone Development. The first tip described how to adjust textfields that are hidden when the onscreen keyboard is shown.

Data / File Management

iPhone File System: Creating, Renaming and Deleting Files

The iPhone provides a comprehensive set of operations for working with files and directories. NSFileManager includes methods for querying the contents of directories, creating, renaming and deleting contents, as well as getting/setting file attributes (readable, writeable, etc).
Point to the Documents Directory
Each application has its own sandbox in which you can read/write files. Files written to [...]

Data / File Management

Get Users Home Directory – Part 2

In the previous tip on working with plists, I showed an example of how to create a path to a file to be stored in the /Documents folder.
In this tip I want to show an example that arrives at the same end result, however, I’ll use methods which will eliminate the hardcoding of paths as [...]

Data / File Management

Get Users Home Directory – Part 1

In a recent application I needed to create several property list files (plists) to store application information. I opted to store the files in the folder named “Documents” off the home folder.
Here is the code I used to specify the path where I wanted the files written and the code to build an NSString with [...]

Data / File Management