When Following the CoreDataBooks sample code and implementing it into my app, I have reached a very odd bug/glitch with an NSNumber(Integer 16).
When I have the code
cell.detailTextLabel.text = [NSString stringWithFormat:@"%i", child.marblesneeded];
开发者_如何学编程the detailTextLabel displays an odd string of numbers that changes every time I try to change the numbers. See Attached Image. Currently, it should display 0 but it displays 112917120.
Thanks!
NSNumber has a method to return you the number as string, which can be used as a label text, as follows:
cell.detailTextLabel.text = [child.marblesneeded stringValue];
Try this:
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", [child.marblesneeded intValue]];
精彩评论