我正在使用 monotouch 开发 iPhone 应用程序。如何以如下图所示的方式在 UITableView 中创建单元格:
他们的背景只是设置为背景图像的图像吗?或者还有另一种方法可以让细胞看起来像这样?
我正在使用 monotouch 开发 iPhone 应用程序。如何以如下图所示的方式在 UITableView 中创建单元格:
他们的背景只是设置为背景图像的图像吗?或者还有另一种方法可以让细胞看起来像这样?
它们就是所谓的Grouped cells
,在 UITableView 中以分组格式显示。
只需将 'style' 选项从 更改为 ,即可在 Interface builder 中更改 UITableView 的Plain
样式Grouped
。
或者,您可以像这样在代码中创建它:
UITableViewController *groupedTableView = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];
UITableView 中的分组单元格示例如下:
与Plain 样式相反,它类似于以下内容:
如果您使用的是 C#/MonoTouch,那么您可以使用 MonoTouch.Dialog 轻松完成此操作。示例可以在这里找到:http: //docs.xamarin.com/guides/ios/user_interface/monotouch.dialog
表格视图具有样式UITableViewStyleGrouped
。
您可以通过以下代码创建 tableViewController:
UITableViewController *myTableViewcontroller = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];