Monday, December 16, 2013

iOS7 > Lesson#18 - Static Table View Application

Background

In this lesson, we will learn:

  • Introduction to Static Table View
  • Create a static table view application



<Introduction to Static Table View>

Static cells can be defined a table view with fixed sets of cells, section header and section footer.

Like the Maps setting page for iPhone 5.0, there are three sections and each has its header:




<Create a static table view application>

Step#1 - Create a new project with Single View Application Template

Different from iOS7 > Lesson#13b - Single Table View Application, we use Single View Application to create a Static Table View Application.



Step#2 - Name the new project as StaticTable


Step#3 - Storyboard

By default, there has a View Controller object. But we no need to use it at this moment, so just delete it.

Drag a Table View Controller object as the initial one.

By default, Xcode sets the table view content with "dynamic content". We can change it to "Static Cells". Once changed, the table view will be included three empty static cells.

But we cannot view these three empty static cells under Xcode 5.0 clearly, they can be shown clearer when we change the Interface Builder (IB) to Xcode 4.6.

Select the Table View Section, we can change the row number, header and footer.

Drag a Label object with Font size "17.0", a Label object with Font size "10.0" and a Switch object for each table cell.

Step#4 - Compile & Run


Step#5 - Storyboard

Select the Table View and change the number of sections from 1 to 2.
Change the number of Section from 1 to 2
We can also change the state from "On" to "Off" as default state.

Step#6 - Compile & Run


No comments:

Post a Comment