如何向UITableView添加描述

时间:2011-05-20 15:06:04

标签: iphone objective-c xcode

如何在this image中添加类似“加利福尼亚”的说明。

5 个答案:

答案 0 :(得分:3)

- (NSInteger)numberOfSections
{
   return 1;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
   if (section == 0)
      return @"California";
   return nil;
}

答案 1 :(得分:1)

它是你的表头。部分的表视图标题。您可以通过实现数据源方法

来获取节头
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

答案 2 :(得分:1)

在UITableViewDataSource(UITableView的委托)中,

此方法控制节标题标题:

 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

答案 3 :(得分:0)

这是一个标题标题。 UITableViewDelegate 方法是:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section  

答案 4 :(得分:0)

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
 UIView * view = [uiview alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 90)];
then Create UIView in UILable ,UItextView etc...
}
then
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
 return 50;
}
相关问题