Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Contents Contents at a Glance .......................................................................................... iv About the Author...............................................................................................xxi About the Technical Reviewer .........................................................................xxii Acknowledgments ..........................................................................................xxiii Introduction ....................................................................................................xxiii Chapter 1: Table Views from the Ground Up.................................................... 1 What Are Table Views? ...........................................................................................................................................1 The Anatomy of a Table View .................................................................................................................................4 Creating a Simple Table View App ..........................................................................................................................5 Creating the Application Skeleton...........................................................................................................................6 Generating Some Data ............................................................................................................................................8 Creating the Table View ........................................................................................................................................12 Conforming to the Table View Protocols ...............................................................................................................14 Wiring Up the Data Source and Delegate ..............................................................................................................15 Displaying the Data ...............................................................................................................................................16 numberOfSectionsInTableView: .......................................................................................................................17 tableView:numberOfRowsInSection: ................................................................................................................17 tableView:cellForRowAtIndexPath: ..................................................................................................................18 Adding Some Interactivity .....................................................................................................................................20 tableView:didSelectRowAtIndexPath: ..............................................................................................................21 Understanding How the App's Objects Fit Together .............................................................................................23 Summary ..............................................................................................................................................................24 Chapter 2: How the Table Fits Together ........................................................ 25 Understanding Table Views ..................................................................................................................................25 Working with the UITableView Family ..................................................................................................................26 The UITableView Class Hierarchy ....................................................................................................................26 Choosing the Type of Table View ..........................................................................................................................27 The Plain Table ................................................................................................................................................27 The Indexed Table ............................................................................................................................................28 The Sectioned Table ........................................................................................................................................29 The Grouped Table ...........................................................................................................................................30 Setting TableView Dimensions .............................................................................................................................32 v