[英]Formatting text in tableView Cell
I want "\\(category.questionCount) Questions" text to be aligned right, while 我希望“ \\(category.questionCount)问题”文本正确对齐,而
"\\(category.categoryName) > \\(category.subCategoryName)" text to be aligned left. “ \\(category.categoryName)> \\(category.subCategoryName)”文本向左对齐。
NOTE: In this case, not sure left alignment is necessary. 注意:在这种情况下,不确定是否需要左对齐。
cell.titleL?.text = "\(category.categoryName) > \(category.subCategoryName) \(category.questionCount) Questions"
You should be using two labels, not one. 您应该使用两个标签,而不是一个。 If a text is too long, you can set firstLabel.numberOfLines=0
, set secondLabel alignment to right. 如果文本太长,则可以设置firstLabel.numberOfLines=0
,将secondLabel对齐方式设置为right。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.