嗨我有一张桌子,想要在label.text中显示表格中有多少项,所以将行数转换为文本字符串
答案 0 :(得分:1)
您需要计算模型(数组或字典计数)并形成字符串:
NSString *rowCountString=[NSString stringWithFormat:@"%d",[yourArray count]]; //or dictionary
//if this is for osx 64 bit use %ld instead of %d
然后在标签中显示字符串。
yourLabel.text = rowCountString; //UILabel ios
[yourLabel setStringValue:rowCountString];//NSTextField as label osx