This is the example of a plist (Property list) to get a feel for how its works.
Step 1: Create a new Xcode project using View based application template.
Step 2: Double click .xib file to open the file in interface Builder.Drop a table view onto the view window. Then click connections inspector,and connect the dataSource and delegate connections to the File’s Owner icon. Next, select table view,and click attributes inspector. Change the table view’s Style to Grouped. After doing that,save,and return to Xcode.
Step 3: This project needs a fair amount of data to do its thing. So we create a property list and add it to Resource folder. Once it’s added to the project ,single click .plist its just look like (below figure 1).It’s a property list that contains a dictionary ,with one entry for each letter of the alphabet.
Figure 1: The sortednames.plist property list file.
Step 4: Single click the ViewController.h file and add both an NSDictionary and an NSArray instance variable and corresponding property declarations. The dictionary will hold all of our data. The array will hold the sections sorted in alphabetical order . And we also need to conform the class to the UITableViewDataSource and UITableViewDelegate protocols:
Step 5: In our tableView:cellForRowAtIndexPath:method,we have to extract both the section and row from the index path and use that to determine which value to use. And the other method, tableView:titleFoeHeaderInSection allows you to specify an optional header value for each section.
NSUInteger section = [indexPath section];
NSUInteger row = [indexPath row];
static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier];
if(cell == nil)
cell=[[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier: SectionsTableIdentifier] autorelease];
cell.text = [nameSection objectAtIndex:row];
You can downloaded SourceCode from here Sections