Implement Trackable-Settable UIControls In iPhone

We will see in this application how to implement trackable-settable UIControls embedded in a UITableView.

Step 1: Create a Window base application using template. Give the appliction name “Cell Touch”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: We need to add the resource file called as “checked.png” and “unchecked.png” into the resource folder. Select resources and add files existing sources and select the checked.png and unchecked.png.

Step 4: Now we’ll add Table view controller class to the project. Choose New file -> Select cocoa touch classes group and then select UITableViewController subclass. Give the name TableViewController.

Step 5: In the AppDelegate.h file we added NavigationController. So make the following changes in the file.




Step 6: In the AppDelegate.m file make the following changes:




Step 7: We added dataArray in the TableViewController.h file, so make the following changes:




Step 8: Now double click your MainWindow.xib file and open it to the Interface Builder. Drag NavigationController from the library and place it the MainWindow. First select navigation controller and bring up Identity Inspector now change the class name into the TableViewController.Double click NavigationController and open it, drag tableview from the library and place into the Navigation Controller Window. Select it and bring up Connection Inspector, you will see there are two available connection DataSource and Delegate. Now connect DataSource to the TableViewController and do it once more time for Delegate. Save it and go back to the Xcode.

Step 9: Create a tabledata.plist for holding the data. What we will display the table.

Step 10: Now make the following changes in the TableViewController.m file.




Step 11: Compile and run the application in the simulator.

You can downloaded SourceCode from here Cell Touch 2

Leave a Comment:

1 comment
coma says October 17, 2012

Where are you actually using a UIControl ?

Add Your Reply