I got an issue here. If I don't format it with the percent thingy I get the correct data. So I know the algorithm is correct. If I use the number formatter, I get bizarre data. For instance, one set of data should return 6% and I got 600%. I thought it was a digit padding issue, but I did other datasets that should had returned 1% and I got 750% instead.
Here is my code:
I am used to coding in C#/C++ so I am used to the old hungarian/camel text style of variable names. I was told by others I don't follow the Cocoa paradigm.
So since it works w/o using the number formatter, as if I just used a standard setIntVal on the label, it works fine. I just wished I can concatenate the double/int with char *! I am obviously new to this so I am eager to learn. Thank you for any help!
Here is my code:
Code:
// ... snip
double Level = level( Points );
double Progress = progress( Points);
[lblLevel setDoubleValue:(Level)];
[pbLevel setDoubleValue:(Progress)];
NSNumberFormatter* formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle: NSNumberFormatterPercentStyle];
// Any other format settings you want
NSString* formattedNumber = [formatter stringFromNumber: [NSNumber numberWithDouble: Progress]];
[lblPercent setStringValue:(formattedNumber)];
// ... snip
I am used to coding in C#/C++ so I am used to the old hungarian/camel text style of variable names. I was told by others I don't follow the Cocoa paradigm.
So since it works w/o using the number formatter, as if I just used a standard setIntVal on the label, it works fine. I just wished I can concatenate the double/int with char *! I am obviously new to this so I am eager to learn. Thank you for any help!