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. 【MavenWeb】初探:创建一个Maven Web项目

    第一步:创建一个Simple的Maven项目 直接点下一步,把name上面的几个部分填写好,直接Finish即可. 就可以看到如下的结构: 注意点1:如果按照网上的其他一些做法来创建,你会发现少了sr ...

  2. Adapter

    11-25 16:09:10.965 22791-22823/myapplication.com.myblue E/HAL: hw_get_module_by_class: lib loaded: / ...

  3. sharepoint---RBS回收站清空设置

    默认天数 :

  4. C# 静态函数调用窗体控件

    回调函数方法是静态函数,需要调用窗体控件,赋值或取值. 定义 public static Form1 mainFrm;   mainFrm = this; public partial class F ...

  5. Linux下如何移除同时在线的用户

    Linux下移除同时在线的用户太多时,shell操作会变得比较卡,很多时候经常是直接关闭终端导致不正常退出,一般要等上一段时间才会退出,这个时候主动结束用户进程使用户下线是比较好的方式,方法如下: 使 ...

  6. ACM/ICPC 之 并查集-食物链(POJ1182)

    并查集的经典题型,POJ上题目还是中文= =,一般看到中文题都会感觉不太简单,这道题的数学归纳用得比较多,可以简化代码,挺有意思的. 同类型的题目还有POJ1703,比这个要简单,想了解并查集基本介绍 ...

  7. ffmpeg-20160525-git-bin

    ESC 退出 0 进度条开关 1 屏幕原始大小 2 屏幕1/2大小 3 屏幕1/3大小 4 屏幕1/4大小 S 下一帧 [ -2秒 ] +2秒 ; -1秒 ' +1秒 下一个帧 -> -5秒 f ...

  8. windows编程中关于“关闭窗口无法退出进程”的解决方法

    一般会出现如下两种情况 1.WinMain函数中,最后阶段接收消息队列循环中,调用的GetMessage函数参数提供错误 如: while (GetMessage(&msg,hwnd, 0, ...

  9. 【linux】linux下动态库so文件的一些认识

    来源:http://mypyg.iteye.com/blog/845915 so其实就是shared object的意思.今天看了上面的博客,感觉好吃力.赶紧做个笔记记录一下.下面的内容大多都是连接中 ...

  10. 【XLL 文档翻译】【第3部分】必要的和有用的 C API XLM 函数

    本节中将介绍几个对于 DLL 和 XLL 开发人员来说十分重要的回调函数,xlfRegister 函数是可用于注册函数,使得 Excel 可以直接访问 DLL 和 XLl 中的函数. xlfUnreg ...