2011-10-11 83 views
1

當遵循CoreDataBooks示例代碼並將其應用到我的應用程序中時,我遇到了一個非常奇怪的錯誤/毛刺,帶有一個NSNumber(整數16)。奇數NSNumber輸出 - 核心數據

當我的代碼

cell.detailTextLabel.text = [NSString stringWithFormat:@"%i", child.marblesneeded]; 

的detailTextLabel顯示每變化我試圖改變號碼時數的奇數串。見附圖。目前,它應顯示0,但它顯示112917120. enter image description here

謝謝!

回答

2

的NSNumber必須返回你的號碼作爲字符串的方法,它可以用作標籤文本,如下所示:

cell.detailTextLabel.text = [child.marblesneeded stringValue]; 
+0

它的作品!非常感謝! –

2

試試這個:

cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", [child.marblesneeded intValue]];