[英]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屬性都可以像這樣使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.