nsdecimalnumber

    0熱度

    2回答

    在我的核心數據模型中,「amount」是實體「Tracking」中的一個屬性。如何在整個代碼中將金額轉換爲NSDecimalNumber?我相信有更多經驗的人可以在3分鐘內做到這一點,我已經看了好幾天。 - (IBAction)save { if (![amount.text isEqualToString:@""]) { Tracking *tracking = [NSEntityDescr

    4熱度

    2回答

    我發送一些數據和UIImage(將UIImage轉換爲NSData)發送到服務器,我的客戶正在回覆我們發送的響應。 但是,在這裏我的客戶給的UIImage像下面的格式 FaceImage":[255,216,255,224,0,16,74,70,73,70,0,1,1,1,1,44,1,44,0,0,255,219,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12,20

    9熱度

    1回答

    根據文檔,[NSDecimalNumber decimalNumberWithString:]應該使用的區域設置小數分隔: 無論NSDecimalSeparator是一個週期(如被使用,例如, 在美國)或逗號(例如,在法國使用) 取決於默認語言環境。 但是當我嘗試它,此代碼: NSLog(@"%@", [NSDecimalNumber decimalNumberWithString:@"100,1

    1熱度

    1回答

    這樣做的最佳做法是什麼: 我有一個NSDecimalNumbers數組,我需要將它們加在一起。 我要建立一個基數,然後循環和每個後續號碼添加到基礎......有點像這樣: NSDecimalNumber* baseNumber = [[NSDecimalNumber alloc] initWithString:[NSString stringWithFormat:@"%f", 0.0]];

    3熱度

    2回答

    在我的ios項目中,我使用兩個實體(CoreData):個人禮品與一對多的關係 我知道如何計算的禮物和一個人: NSDecimalNumber *orderSum=[person.gifts valueForKeyPath:@"@sum.priceOfGift"]; 但我如何計算所有人的總和? -(NSFetchedResultsController *) fetchedResultsCont

    -1熱度

    3回答

    我在其中工作了很多,並且找不到解決方案。即使標題也無法清楚解釋。 我 我已經做了以下 float wq = [[weightarray objectAtIndex:selectedint]floatValue]; float q = [quantity floatValue]; float total = wq * q; 爲前三個值重量,數量和總,如果 ​​ 那麼結果是 wq = 3.14

    2熱度

    1回答

    很奇怪NSDecimalNumber精度誤差(或者也許是我沒有看到操作錯誤)與RestKit v 0.10.2 類定義: .... @property (nonatomic, assign) NSInteger menuItemId; @property (nonatomic, strong) NSString *menuItemTitle; @property (nonatomic, st

    0熱度

    3回答

    我有一個NSMutableArray其中有一些NSDecimalNumber在裏面,像(500,50.80,70,8000) 現在我想補充所有這些decimal numbers在一起。 我試着使用 for (NSDecimalNumber *number in self.numbersArray) { NSDecimal *sum += [number decimalValue] }

    0熱度

    3回答

    說我有以下值對於這些高德: 的NSString *百分比= 35 的NSString *值= 146 在我的代碼下面我期待着得到51.1當我做我的乘(146 * 0.35),而是我得到100 - (NSDecimalNumber*) getProductByPercentage : (NSArray*) itemsToMultiply : (float) annualPatients {

    4熱度

    1回答

    因此,這裏的代碼: NSDecimalNumber *test=[[NSDecimalNumber alloc] initWithInt:65]; number3=[[NSDecimalNumber one] decimalNumberByDividingBy:[[[NSDecimalNumber alloc] initWithInt:10] decimalNumberByRaisingToPo