https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/CreateConfigureTableView/CreateConfigureTableView.html#//apple_ref/doc/uid/TP40007451-CH6-SW10

Creating a Table View Programmatically

If you choose not use UITableViewController for table view management, you must replicate what this class gives you "for free".

Adopt the Data Source and Delegate Protocols

@interface RootViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) NSArray *timeZoneNames;
@end

Create and Configure a Table View

第二步就是 allocate and initialize an instance of the UITableView class.

- (void)loadView
{
    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
    tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
    tableView.delegate = self;
    tableView.dataSource = self;
    [tableView reloadData];

    self.view = tableView;
}

Creating a Table View Programmatically的更多相关文章

  1. Table View Programming Guide for iOS---(五)---Creating and Configuring a Table View

    Creating and Configuring a Table View Your app must present a table view to users before it can mana ...

  2. 【IOS笔记】Creating Custom Content View Controllers

    Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of ...

  3. iphone dev 入门实例1:Use Storyboards to Build Table View

    http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ Creating Navig ...

  4. Table View Programming Guide for iOS---(七)---Managing Selections

    Managing Selections 管理选择 When users tap a row of a table view, usually something happens as a result ...

  5. View Controller Programming Guide for iOS---(四)---Creating Custom Content View Controllers

    Creating Custom Content View Controllers 创建自定义内容视图控制器 Custom content view controllers are the heart ...

  6. Table View Programming Guide for iOS---(四)---Navigating a Data Hierarchy with Table Views

    Navigating a Data Hierarchy with Table Views 导航数据表视图层次 A common use of table views—and one to which ...

  7. Table View Programming Guide for iOS---(一)---About Table Views in iOS Apps

    About Table Views in iOS Apps Table views are versatile user interface objects frequently found in i ...

  8. How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views

    How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views  Ellen S ...

  9. Table View Programming Guide for iOS---(六)---A Closer Look at Table View Cells

    A Closer Look at Table View Cells A table view uses cell objects to draw its visible rows and then c ...

随机推荐

  1. ubuntu安装skype

    1.添加源 sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner&quo ...

  2. C#时间转整型(时间戳),模仿php strtotime函数的部分功能

    今天需要将一个基于MS SQL数据库的新闻系统数据导入phpcms v9,源系统新闻日期格式为"2014-01-15 10:45:49",而phpcms中使用的是整型时间戳,在ph ...

  3. 【GoLang】GoLang for 中有多个循环变量怎么处理?

    代码示例: sum := , ; i <= && j <= ; i, j = i+, j- { t.Log("i: ", i) t.Log(" ...

  4. java 中for each语句

    [转]java foreach 使用   foreach语句是java5的新特征之一,在遍历数组.集合方面,foreach为开发人员提供了极大的方便.   foreach语句是for语句的特殊简化版本 ...

  5. struts2 如何实现mvc 的?

  6. (转)Xcode调试技巧

    转自http://www.apkbus.com/android-140340-1-1.html 这篇文章给大家带来的是一些Xcode实用技巧,比如: • 摆脱NSlog打印输出,使用断点日志. • 摆 ...

  7. ios oc 和 swfit 用dispatch_once 创建单例

    网上已经有方法了,我这里就是抄了下,原文链接 http://bj007.blog.51cto.com/1701577/649413 http://blog.csdn.net/u010124617/ar ...

  8. 4.js模式-发布-订阅模式

    1. 发布-订阅模式 var observe = (function(){ var events = {}, listen, trigger, remmove; listen = function(k ...

  9. java 基础第一季

    1. i安装jdk ii 配置环境变量:JAVA_HOME 配置jdk的安装路径 path            配置命令文件的位置 bin目录的安装路径 PATH_HOME 配置库文件的位置   l ...

  10. [转]Handler MessageQueue Looper消息循环原理分析

    Handler MessageQueue Looper消息循环原理分析   Handler概述 Handler在Android开发中非常重要,最常见的使用场景就是在子线程需要更新UI,用Handler ...