Truncate beginning of label

后端 未结 2 918
孤城傲影
孤城傲影 2021-01-23 23:44

I have a label (NSTextField) with text aligned right. When the text becomes too large to display, the end of the text is truncated (at the right edge of the label).

2条回答
  •  广开言路
    2021-01-24 00:00

    What you're looking for is

    [[myTextField cell] setLineBreakMode: NSLineBreakByTruncatingHead];
    

    Swift:

    myTextField.cell.lineBreakMode = NSLineBreakMode.ByTruncatingHead
    

提交回复
热议问题