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. mysql 表关联查询报错 ERROR 1267 (HY000)

    解决翻案:http://stackoverflow.com/questions/1008287/illegal-mix-of-collations-mysql-error 即: SET collati ...

  2. js 函数前的+号

    不知啥时候起,函数的闭包需要增加+才能立即执行了. 不加反而报语法错.orz +function() { console.log("Foo!"); }(); 输出: Foo!< ...

  3. ubuntu彻底卸载mysql

    1.删除mysql sudo apt-get autoremove --purge mysql-server-5.0 sudo apt-get remove mysql-server sudo apt ...

  4. ITIL与ITSM的联系与区别

    1.ITIL(IT Infrastructure Library)是CCTA(英国国家计算机和电信局)于20世纪80年代末开发的一套IT服务管理标准库,它把英国各个行业在IT管理方面的最佳实践归纳起来 ...

  5. SVN里常见的图标及其含义

    - 已忽略版本控制的文件.可以通过Window → Preferences → Team → Ignored Resources.来忽略文件.A file ignored by version con ...

  6. espcms内容页相册调用代码

    {%forlist from=$photo key=i%} <li style="position: absolute; width: 600px; left: 0px; top: 0 ...

  7. ubuntu下查找某个文件的路径

    参考:ubuntu下如何查找某个文件的路径      http://blog.csdn.net/lieyanhaipo/article/details/17055667 在Ubuntu有时候会遇到记得 ...

  8. 抓取网页内容生成kindle电子书

    参考: http://calibre-ebook.com/download_linux http://blog.codinglabs.org/articles/convert-html-to-kind ...

  9. Icon Font的转换

    Icon Font是用于网页的纯色图标,这里引用一张网络图片: 由于体积小,易维护等特点,IconFont应用非常广泛. 这里推荐一个转换器,通过Upload一个后缀ttf的字体文件,可以反解出文件下 ...

  10. 【leetcode】Convert Sorted List to Binary Search Tree (middle)

    Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...