Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2110871
  • 博文数量: 413
  • 博客积分: 10926
  • 博客等级: 上将
  • 技术积分: 3862
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-09 18:14
文章分类

全部博文(413)

文章存档

2015年(5)

2014年(1)

2013年(5)

2012年(6)

2011年(138)

2010年(85)

2009年(42)

2008年(46)

2007年(26)

2006年(59)

分类:

2010-04-23 09:40:23

  1. Introduction
    Table views are the most common mechanism used to display lists of data to users, each item in a table's list is a row. iPhone can contains unlimited number of rows, constrained by the amount of available memory. iPhone tables can be only one column.
    Table views are implemented as class UITableView. Table views are not responsible for storing your table's data, they only store enouth data to draw the rows that are currently visible. Table views get their configuration data from an object that conforms to the UITableViewDelete protocol, and their row data from an object that conforms the UITableViewDataSource protocol.
    Table view cells are implemented as class UITableViewCell. Each UITableViewCell object can only be configured with an image, some texts, and optional accessory icon. An accessory icon is a small icon on the right side of the rwo.
  2. UITableViewCell
    • Set text
    • Text fonts
    • Image
  3. UITableViewDelegate
    • Indent level
    • Row selected event
      before and after row selected event, in before row selected event, you can configure whether prevent the row to be selected by returing value)
    • Row height
    • Section
  4. UITableViewDataSource
  5. How to set delegate and data source
    • Add table view in Nib
    • Add delegate and data source outlets in File Owners class
    • Establish connection to outlet delegate and data source
  6. How To Cumtomize UITableViewCell
    By default, table view cell only display a single line of text, if you want show multiple lines by specifying a string containing carriage return, table view will remove carriage return, and diaplay the data on a single line. Instead, there are two ways to customize UITableViewCell:
    1. Subclass UITableViewCell
      • Create a Nib file
      • Add UITableViewCell into the Nib file
      • Add some views (UILable ... ) in the cell view in Nib
      • Create a class inherits from UITableViewCell
      • Add outlets in UITableViewCell subclass
      • In Nib file, press Command-4 to bring up identity inspector, then change the class of table view cell to UITableViewCell subclass
      • Establish outlets  connection
      • When you create table view cell in delegate, use UITableViewCell subclass instead.
    2. Customize UITableViewCell Layout
      When create UITableViewCell in tabView:cellForRowAtIndex:, create some sub views, set position/size of theses sub views, and then add these sub views to UITableViweCell using contentview:addSubView, you can use tag to identify each sub views.
    3. ...
  7. Grouped and Indexed list
  8. ...
  9. ....


Reference
  1. Beginning iPhone Development: Exploring the iPhone SDK
    Chapter: Application Settings and User Defaults
    Page: P186~230

阅读(1519) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~