簡體   English   中英

使用Eureka表單隱藏部分的頁眉和頁腳

[英]Hiding the header and the footer of a section using Eureka forms

我正在使用Eureka創建注冊頁面。 我只有一個部分。 我想隱藏該部分的頁眉和頁腳,但沒有找到一種方法。 任何幫助將不勝感激。

如果您使用的是默認節的頁眉/頁腳字符串設置,則可以將它們設置為“”,但我相信這仍會留出通常在標簽/字符串處留出的細微空間。

您的另一個(可能更安全)選項可能是創建自定義Header / Footer類,並使用框架屬性(寬度/高度= 1px)相應地調整其大小。 我自己尚未對此進行測試,但是我使用自定義類在標簽旁邊呈現徽標,並將所有內容調整為所需的寬度/高度。

希望這可以幫助。

選項1:

+++ Section(header: "", footer: "") {_ in
    }

Swift 4和Eureka 4.0.1的更新:

選項2:

+++ Section(){ (section) in
        section.header = HeaderFooterView<NoHeader>(HeaderFooterProvider.class)
    }

class NoHeader: UIView {

    override init(frame: CGRect) {
        super.init(frame: CGRect(x: 0, y: -1, width: 1, height: 1))
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

斯威夫特3:

選項2:

+++ Section(header: "", footer: "") {
            $0.header = HeaderFooterView<NoHeader>(HeaderFooterProvider.Class)
        }

class NoHeader: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.frame = CGRect(x: 1, y: -3, width: 1, height: 1)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

如果您的ViewController是從FormViewController擴展的,則可以使用此代碼。

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    return nil
}

override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return 0
}

您也可以將其添加到FormViewController中:

self.tableView.sectionFooterHeight = 0
self.tableView.sectionHeaderHeight = 0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM