簡體   English   中英

如何使用Eureka制作多線標簽

[英]How to make multiline label with Eureka

我使用Eureka庫 ,我遇到了一個問題。 我需要一個多行標簽行,但不知道該怎么做。 我只能看到帶截斷標簽行的單行。

 class MainViewController: FormViewController {
    override func viewDidLoad() {
      super.viewDidLoad()

      form +++=

        Section()

        <<< LabelRow { row in
            row.title = "Hello World 1. Hello World 2. Hello World 3"
        }
 }

使用row.cell可以獲得整個單元格,您可以自定義它。

標簽行應該是這樣的:

<<< LabelRow { row in
    row.title = "Hello World 1. Hello World 2. Hello World 3"
    row.cell.textLabel?.numberOfLines = 0
}

接受的答案是可以的,但要更好。 您可以對所有LabelRow,TextAreaRow等使用defaultCallSetup 如下所示。

LabelRow.defaultCellSetup = {cell, row in
    cell.textLabel?.font = UIFont(name: "Your_Custom_font_Name", size: 13)
    cell.detailTextLabel?.textColor = UIColor.yellow
    cell.textLabel?.numberOfLines = 0
    cell.textLabel?.textAlignment = .justified
    cell.textLabel?.backgroundColor = UIColor.clear
}


+++ LabelRow(){
       $0.title = "Question    :   Current Occupancy and long text goes"
    }

所有textLabel屬性都可以像這樣使用。

我不太確定你的Eureka庫是做什么的,但是如果你想在你的故事板中為你的標簽設置多行,只需將“Lines”屬性更改為0即可。

如果您的標簽位於UITableViewCell ,則需要設置動態UITableViewCell高度。

在此輸入圖像描述

暫無
暫無

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

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