字符串固定宽度自动换行,之前一直做是没有问题的,可能是这次的字体有些特殊。导致固定宽度下每行的字符个数不一致。
所以每两个字符之间添加换行符
//去除,
NSString *name = [themeModel.theme_name stringByReplacingOccurrencesOfString:@"," withString:@""];
NSMutableString *title = [name mutableCopy];
for (NSInteger i = title.length -2 ; i >= 2 ; i -= 2) {
[title insertString:@"\n" atIndex:i];
if (i <= 2) {
self.titleLB.text =title;
[self setUI];
}
}