标签: uitableviewsectionheader

Swift - tableView 行高仅在滚动或切换展开/折叠后更新

从这里使用CollapsibleTableView并根据我的要求修改它以实现可折叠部分。这是它现在的样子

由于根据 UI 设计,我的部分有一个边框,因此我选择了部分标题作为我的 UI 元素,在折叠和展开模式下都保存数据。

原因:我尝试过但无法在下面解释的这个模型中工作 -

** 在部分标题中包含我的标题元素,并在其单元格中包含每个项目的详细信息。默认情况下,该部分处于折叠状态。当用户点击标题时,单元格被切换显示。正如我所说,由于需要向整个部分(点击的标题及其单元格)显示一个边框,因此我选择了部分标题作为我的 UI 操作元素。这是我的 tableView 代码 -

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return sections.count 
    }

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        switch indexPath.row {
        case 0:
            return sections[indexPath.section].collapsed! ? 0 : (100.0 + heightOfLabel2!)
        case 1:
            return 0
        case 2:
            return 0
        default:
            return 0
        }
    }


func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

        let header …
Run Code Online (Sandbox Code Playgroud)

tableview ios swift uitableviewsectionheader

5
推荐指数
1
解决办法
2683
查看次数

xcode警告“估计iOS 11之前的部分页脚高度”是什么意思?

有人知道这个警告的意思吗?我不明白它所描述的问题。如果我在不应该提供的时候提供了估计的身高,为什么会有问题?

以下是更多信息和屏幕截图: Xcode中页眉/页脚高度警告的屏幕截图 Xcode中的页脚高度和估算值的屏幕截图

我的目标是iOS 10,因为我想支持较旧的设备。

在tableViewController中,我同时覆盖了heightForFooterInSectionestimatedHeightForFooterInSection(它们各自提供相同的值,是2种可能的高度之一)

我正在使用此方法将视图加载到页脚中:Swift-如何使用XIB文件创建自定义viewForHeaderInSection。

xcode compiler-warnings suppress-warnings ios uitableviewsectionheader

5
推荐指数
1
解决办法
491
查看次数

在UITableView HeaderView中检测UISegmentedControl中的更改

我试图控制我的UITableView基础上selectedSegmentIndexUISegmentedControl我的UITableView水箱内.从本质上讲,我希望这UISegmentedControl可以像推特的"我"标签一样工作.我有UISegmentedControl一个UITableView标题内部,它使用此方法出列:

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    let cell = tableView.dequeueReusableCell(withIdentifier: "sectionDetailsHeaderView") as! SectionDetailsHeaderTableViewCell
    return cell
}
Run Code Online (Sandbox Code Playgroud)

我有一个连接到UISegmentedControl的插座SectionDetailsHeaderTableViewCell,但我无法弄清楚如何检测UISegmentedControl中的更改.我想设置一个变量,var segmentedControlValue = Int()selectedSegmentIndex每一次的修改,然后调用一个函数,func chooseDataToDisplay() {}该值改变时.我该怎么做呢?

uitableview uisegmentedcontrol ios swift uitableviewsectionheader

3
推荐指数
1
解决办法
1348
查看次数

检测UITableView节标题何时捕捉到屏幕顶部

我想检测UITableView节标题何时贴紧在屏幕顶部,然后修改标题的高度,但是我不知道该怎么做。有人可以帮忙吗?

uitableview ios swift uitableviewsectionheader

3
推荐指数
2
解决办法
1650
查看次数

使用UITableViewAutomaticDimension无法在UITableView中隐藏节标题

我有一个UITableView与节标题.对于单元格和标题,整个tableview都设置了UITableViewAutomaticDimension:

class ViewController: UIViewController {

    @IBOutlet weak var tableView: UITableView!
    @IBOutlet var sectionHeader: MyTableViewHeaderFooterView!

    let data = [
        "Lorem ipsum dolor sit amet",
        "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation",
        "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
    ]

    override func viewDidLoad() { …
Run Code Online (Sandbox Code Playgroud)

uitableview ios uitableviewsectionheader

1
推荐指数
1
解决办法
809
查看次数

viewForHeaderInSection在xcode 8中停止工作

我有一个包含2个部分的tableView,sections数组用2个元素固定.这些部分的标题显示正常,因为下面的代码显示在Xcode 7中.我刚刚升级到Xcode 8,并且部分标题不再显示,下面的代码不再被调用.

有任何想法吗?

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 18)];
    /* Create custom view to display section header... */
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, tableView.frame.size.width, 18)];
    [label setFont:[UIFont boldSystemFontOfSize:16]];
    NSString *date =[sections objectAtIndex:section];
    /* Section header is in 0th index... */
    [label setText:date];
    [view addSubview:label];
    [view setBackgroundColor:[DeviceHelper Orange]]; //[UIColor colorWithRed:166/255.0 green:177/255.0 blue:186/255.0 alpha:1.0]]; //your background color...
    return view;
}
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios uitableviewsectionheader

-2
推荐指数
1
解决办法
2810
查看次数