UItableView:嵌套标题部分

时间:2016-01-19 07:29:19

标签: ios objective-c nsdate nsdateformatter

在这里,我设置了描述,价格以及从 - 到的位置,但是无法设置日期和时间,如上图所示。格式面临一些问题,将日期设置在一个标题中,时间设置在另一个标题中。如果任何显示如何设置嵌套标题的链接会对我有所帮助。

提前致谢。

enter image description here

2 个答案:

答案 0 :(得分:0)

是的,如图所示无法在中间添加分隔符。我也试过这个

...

private:
    static CEdit m_progress;
public:
    static void setProgress(std::string message);

...

}

但是在滚动tableview时面临日期视图受到干扰的问题。

答案 1 :(得分:-1)

创建一个xib文件,其中包含UIView和标签,如附带的屏幕截图所示。 xib with seperator

  1. 拥有一个名为CustomHeader的源文件,它是UIView的子类。
  2. 使用CustomHeader类映射您的xib视图。
  3. 为xib中添加的标签生成IBOutlets
  4. 使用ViewController viewForHeaderInSection方法

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    NSArray * bundleArray = [[NSBundle mainBundle] loadNibNamed:@"View" owner:self options:nil];
    CustomUIClass * view = (CustomUIClass *) [bundleArray objectAtIndex:0];
    return view;
    

    }

    同时覆盖heightForHeaderInSection

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 69.0f;
    

    }

    这里' 69'是xib的高度。现在你的tableview看起来像附加的截图。

    Customized tableview header

    像这样,您可以根据自己的要求自定义标题。