【发布时间】:2015-03-17 12:53:57
【问题描述】:
我有一个标签,如果我在标签上添加文本,它会在文本的开头添加一个额外的空格,应用程序仅支持纵向。尝试了以下解决方案,但没有用。附上图片供参考。
我在 xib 中创建了这个标签 行数 2 具有前导、尾随、底部空间到容器的约束,高度不固定,
并设置文本像
dealName.text = "Cup of Coffee with A asdf asd asdf adsf ads fad"
UILabel extra spaces before and after text ios
UIlabel shows extra space before text
多行UILabel
单行UILabel
【问题讨论】:
-
请检查标签字符串可能是标签字符串包含空格。
-
仔细检查,没有空格。
-
检查标签对齐方式
-
标签左对齐。看到第二行左对齐。但不是第一行。
-
你提供的额外空间 dealName.text = "一杯咖啡和 A asdf asd asdf adsf ads fad" 它应该是 dealName.text = "Cup of Coffee with A asdf asd asdf adsf ads fad" .