0
以下將返回「14.00」,「16.00」等數據。我想在表格單元上顯示它爲$ 14 $ 16Xcode中的字符串格式
謝謝。
cell.lbl_Rental_Fee.text = [[self.responseData_In_Array objectAtIndex:indexPath.row] objectForKey:@"Rental_Fee_Hour"];
以下將返回「14.00」,「16.00」等數據。我想在表格單元上顯示它爲$ 14 $ 16Xcode中的字符串格式
謝謝。
cell.lbl_Rental_Fee.text = [[self.responseData_In_Array objectAtIndex:indexPath.row] objectForKey:@"Rental_Fee_Hour"];
你會想是這樣假設你的價值是float
NSString *thing = [NSString stringWithFormat:@"$%.0f", yourValue];
所以在你的例子:
NSString *response = [[self.responseData_In_Array objectAtIndex:indexPath.row] objectForKey:@"Rental_Fee_Hour"];
float yourValue = [response floatValue];
cell.lbl_Rental_Fee.text = [NSString stringWithFormat:@"$%.0f", yourValue];