How do you set the text in an NSTextField?

前端 未结 7 2204
孤城傲影
孤城傲影 2020-12-08 12:39

I\'m trying to set the text in an NSTextField, but the -setStringValue: and -setTitleWithMnemonic: methods are not working. Any ideas?

7条回答
  •  独厮守ぢ
    2020-12-08 13:09

    ObjectiveC:

    [label setStringValue: @"I am a label"];
    

    original code I use in my code to display application version is:

        [lblVersion setStringValue:[NSString stringWithFormat:@"v%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]]];
    

提交回复
热议问题