I have a NSNumber from core data that needs to have a % sign after the number displayed... The problem is the number comes from core data and is displayed using the code from a nib... I have no way to format that display... it simply comes from this 9:subtotal
{ SCCustomCell *customCell = [SCCustomCell cellWithText:nil objectBindingsString:@"1:plantName.title;2:plantCondition.title;3:plantSize.title;4:price;11:dateofHire;9:subtotal;10:subtotal_additional_costs;" nibName:@"plantCell2"];
I notice in the debugger panel that the NSNumber is converted to an NSString and the % sign is appended to the end. BUT it does not show up that way in my tableviewcell from the above code (again - as I use the custom cell calling tag #9 in plantCell2... any ideas? Images attached for review...
- (void)calculateAdditionalCosts { NSString *keyadditionalcosts = @"subtotal_additional_costs"; float vacationvalue = [self.vacationpay floatValue]; float unemploymentvalue = [self.unemployment floatValue]; float socialsecurityvalue = [self.socialsecuritytax floatValue]; float medicarevalue = [self.medicaretax floatValue]; float commissonvalue = [self.commissionrate floatValue]; float allowancevalue = [self.allowancerate floatValue]; float othervalue = [self.othertax floatValue]; float sstotal_additionalcosts = ((vacationvalue) + (unemploymentvalue) + (socialsecurityvalue) + (medicarevalue) + (commissonvalue) + (allowancevalue) + (othervalue)); // convert to show % [self willChangeValueForKey:keyadditionalcosts]; self.subtotal_additional_costs = [NSNumber numberWithFloat:sstotal_additionalcosts]; NSString *myString = [NSString stringWithFormat:@"%@", [NSNumber numberWithFloat:sstotal_additionalcosts]]; myString = [myString stringByAppendingString:@"%"]; NSLog(@"%@", myString); }
The number is displayed correctly mathematically... just wish I could format that number result to show the % symbol and also, the $ on one of my other numbers...