【问题标题】:Limiting the text length in a cell in NSTableView column限制 NSTableView 列中单元格中的文本长度
【发布时间】:2011-11-03 19:53:33
【问题描述】:

我有一个有 2 列的 NSTableView。我确实有代码可以在每行的单元格中输入文本。 有没有办法限制单元格中输入的字符数最多为 10?

【问题讨论】:

    标签: iphone objective-c cocoa nstableview nstablecolumn


    【解决方案1】:

    您不能告诉单元格自身剪切 NSString。但是你可以剪切 inputString

    cell.textLabel.text = [yourString substringToIndex:10];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-19
      • 1970-01-01
      • 2015-06-13
      • 2017-02-19
      • 2012-12-16
      • 1970-01-01
      • 2015-09-13
      • 1970-01-01
      相关资源
      最近更新 更多