2013-06-05 39 views
0

我搜索了苹果的文档和在线,并找不到任何有关如何创建分隔符的参考,如下图所示。有蓝线包含分隔每个单元格的字符串。UITableView上的分隔线

我将如何创建这些?谢谢。

Things (C) CulturedCode

回答

0

这些都是 “科头视图”。您可以通过执行UITableViewDelegate协议来提供它们。具体是tableView:viewForHeaderInSection:方法。

希望这会有所帮助!

0

要添加到@ LuisCien的答案,您可能还需要实施UITableViewDataSource协议。您需要提供您的表格可容纳的部分数量。这里有一些方法来考虑:

UITableViewDataSource

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  • tableView:titleForHeaderInSection:
+0

是的,谢谢你。我已经有了这些。 – eulr

0
Here You can add your customView 
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{ 

} 
Here you can add your title 
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 
{ 
} 
here you can define the number of section 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
}