0
votes

I am very new to objective-c xcode macos, but I think this is an easy question.

I am experimenting with writing a saved NSString to an NSTextField. Currently, I have:

NSString *teststring = @"10";

just to set *teststring to 10 as a test. I am able to programmatically update an NSTextField by using this:

[_TextField setStringValue:[NSString stringWithFormat:@"test"]];

This works, and updates my NSTextField to read "test." However, what I would like to do is instead of having the NSText write "test," I want it to write the value of *teststring (currently 10).

I assume it is something easy along the lines of (but I know this isn't right):

[_ServerVersion setStringValue:[NSString *teststring]];

What is the proper way to Write saved NSString to the NSTextField?

1
[NSString stringWithFormat:@"%@", test] - skaak
That is how you can format a string inside another string, but actually, why not just [_TextField setStringValue:teststring] ? - skaak

1 Answers

0
votes

Thank you skaak

[_TextField setStringValue:teststring];

Was what I needed.