【发布时间】:2014-03-14 10:35:35
【问题描述】:
我想在函数 stringWithFormat 中使用\t 时指定制表符长度或制表位:
buttonText3 = [NSString stringWithFormat:@"D:\t%ld:%02ld" , hoursAndMinutesDay.hours,hoursAndMinutesDay.minutes];
我已经尝试在制表符后使用退格键,但这不起作用:
[NSString stringWithFormat:@"D:\t%c%ld:%02ld", 0x0008, hoursAndMinutesDay.hours,hoursAndMinutesDay.minutes];
使用多个空格代替\t 不是一个选项,因为\t 之前的文本具有不同的宽度,具体取决于字符。
【问题讨论】:
-
你在创建字符串后对它做了什么(什么将它呈现到屏幕上)?
-
@iPatel 他说空间不适合他。
-
@Wain:我想在 UITextLabel 中显示它。
-
总能得到之前的字符串长度,决定要加多少空格...
标签: ios objective-c stringwithformat tabstop