4.1 Instantiating a Table View

来源:互联网 发布:mac双系统重新分区 编辑:程序博客网 时间:2024/06/10 15:51

创建是很简单的啦
1,直接在object library里面拖一个出来就可以了
2,代码创建
UITableView *myTableView =
[[UITableView alloc] initWithFrame:self.view.bounds
style:UITableViewStylePlain];
[self.view addSubview:self.myTableView];

其中style有两种值
UITableViewStylePlain 简单的平板的表,没有背景图
UITableViewStyleGrouped 有背景图,有分组,就像设置app的那个。

此时运行程序可以看到一张空表,想不想往里面加些东西呢,看看本章后面的内容