今天使用模拟器测试,发现有个UITableViewCell的detailTextLabel没有完全显示字符串,结尾是省略号,字符串的值中间显示有空格,如

'Test 01'显示为'Te...'

detailTextLabel默认自动计算frame,考虑可能是空格导致计算不正确,但是使用普通空格测试发现正常。

使用测试代码查看字符串的十六进制

            const char *c =[string UTF8String];
            int len = strlen(c);
            while  (len) {
                NSLog(@"%x",*c);
                c++;
                len--;
            }

 打印出来对应为9,而正常空格为20, ascii 0x9 水平定位符号, ascii 0x20 空格,原因是使用模拟器键盘时,无意使用tab导致字符串中有空格。

 

 

 

相关文章:

  • 2021-08-18
  • 2021-11-20
  • 2022-01-04
  • 2022-01-19
  • 2022-12-23
  • 2021-04-13
  • 2022-01-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-10-09
  • 2022-12-23
  • 2021-05-15
  • 2022-12-23
相关资源
相似解决方案