Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
        }
 }
like image 584
Andrey M. Avatar asked Jun 29 '16 07:06

Andrey M.


2 Answers

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
}
like image 149
Altimir Antonov Avatar answered Oct 15 '22 13:10

Altimir Antonov


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.

like image 40
iSrinivasan27 Avatar answered Oct 15 '22 11:10

iSrinivasan27