bluetooth99 2013-02-28 02:38 采纳率: 0%
浏览 2147
已采纳

关于给指定的table加标题

在工程中有两个UITableView,然后我给其中一个加自定义标题:

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    if(tableView.tag == 3)
    {
    SectionInfo *array  = [self.sectionInfoArray objectAtIndex:section];
    if (!array.sectionView)
    {
        NSString *title = array.groupdeck.groupTitle;
        array.sectionView = [[SectionView alloc] initWithFrame:CGRectMake(0, 0, tblData.bounds.size.width, 45) WithTitle:title Section:section delegate:self];
    }
    return array.sectionView;
    }
    else{
        return 0;
    }

return 0;
}

然后就会出现如下结果:

CSDN移动问答

但是别的表标题就是默认的,还会return 0

CSDN移动问答

  • 写回答

2条回答

  • xinyoulingxi1_tong 2013-02-28 06:17
    关注

    试试:

    otherTable.sectionHeaderHeight = 0.0;
    

    不用再加别的了。

    或者:

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
     { 
          if(tableView.tag == 3)
          {
              //Required height.
          }
          else
          {
              return 0.0; 
          }
     }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?