8

我使用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"
        }
 }
4

3 回答 3

24

有了row.cell整个单元格,您就可以对其进行自定义。

标签行应该是这样的:

<<< LabelRow { row in
    row.title = "Hello World 1. Hello World 2. Hello World 3"
    row.cell.textLabel?.numberOfLines = 0
}
于 2016-06-29T09:29:26.170 回答
4

接受的答案是好的,但要更好。您可以对所有 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 属性都可以这样使用。

于 2018-09-11T13:35:55.413 回答
-2

我不太确定你的 Eureka 库做了什么,但是如果你想在你的故事板中为你的标签设置多行,只需将“Lines”属性更改为 0。

如果您的标签在 a 内UITableViewCell,则需要设置动态UITableViewCell高度。

在此处输入图像描述

于 2016-06-29T08:12:34.403 回答