Andrey M.
Andrey M.

Reputation: 3079

How to make multiline label with Eureka

I use Eureka library and i encountered a problem. I need a multiline label row but don't know how to do it. I can see only one-line with truncation label rows.

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

      form +++=

        Section()

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

Upvotes: 9

Views: 4338

Answers (3)

iSrinivasan27
iSrinivasan27

Reputation: 1426

Accepted answer is okay but to be better. You can use defaultCallSetup for your all LabelRow, TextAreaRow and others. Do like as below.

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"
    }

All textLabel attributes can be used just like that.

Upvotes: 4

Altimir Antonov
Altimir Antonov

Reputation: 5056

With row.cell you get the whole cell and you can customize it.

The label row should like something like this:

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

Upvotes: 25

jo3birdtalk
jo3birdtalk

Reputation: 616

I'm not too sure what your Eureka library does, however if you want to have multi lines for your label, inside your storyboard, just change the "Lines" property to 0.

If your label is inside a UITableViewCell, you need set a dynamic UITableViewCell height.

enter image description here

Upvotes: -2

Related Questions