NSNumber *quantity = [NSNumber numberWithDouble:1];
NSNumber *price_vat = [NSNumber numberWithDouble:0.76];
double totalPrice = 293;
totalPrice = totalPrice + [quantity doubleValue] * [price_vat doubleValue];
NSString *s = [NSString stringWithFormat:@"%0.2f", totalPrice];
NSLog(@"total: %@", s);
// in case we're testing without the IBOutlet connected,
// don't try to set its .text
if (nil != self.priceLabel) {
self.priceLabel.text = s;
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎