我有一个标签,如果我添加文本标签,它在文本的开头添加了一个额外的空格,app只支持纵向方向。试过以下解决方案,但没有用。附图供参考。
我在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单线
尝试这可能是在字符之前有任何空格这将删除此..
NSString *trimmed = [yourstring stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
yourlable.text = trimmed;
要么
另请参阅是否从此处设置属性段间距。