I'm trying to learn Cocoa and Objective-C. I've got a method described like so:
The function needs to return an NSString pointer. The problem is, I have an int that I need to return as the NSString. I think there are round-about ways I could do this (like make the int an NSNumber and then make that an NSString), but I'm looking for a more direct method. This seems like it would be a fairly common need as most of the Cocoa GUI components require NSStrings, so I was expecting to be able to do something like:
But that's not working. Neither is (NSString *)myInt.
Can anyone help?
Thanks
Code:
- (NSString *)buttonClicked:(int)buttonNumber;
The function needs to return an NSString pointer. The problem is, I have an int that I need to return as the NSString. I think there are round-about ways I could do this (like make the int an NSNumber and then make that an NSString), but I'm looking for a more direct method. This seems like it would be a fairly common need as most of the Cocoa GUI components require NSStrings, so I was expecting to be able to do something like:
Code:
NSString *returnString;
int myInt;
myInt = 54;
*returnString = @"" + myInt;
return returnString;
But that's not working. Neither is (NSString *)myInt.
Can anyone help?
Thanks