Questions tagged [nsnumber]

on Mac OS X, NSNumber is a subclass of NSValue that offers a value as any C scalar (numeric) type

NSNumber is a subclass of NSValue that offers a value as any C scalar (numeric) type. It defines a set of methods specifically for setting and accessing the value as a signed or unsigned char, short int, int, long int, long long int, float, or double or as a BOOL. (Note that number objects do not necessarily preserve the type they are created with.)

Resource

785 questions
0
votes
1 answer

UISlider value, converted to NSNumber, = -1.10311e-146

AI have a slider, I'm saving it's value to user defaults, and then grabbing that number in a different view. I'm then converting that float to an NSNumber for use in a CiRadialGradient filter. I'm saving the value like: [[NSUserDefaults…
mrEmpty
  • 841
  • 4
  • 19
  • 36
0
votes
0 answers

Objective C - Sort Numbers From An Array While Maintaining Old Indexes

Possible Duplicate: How to sort NSMutableArray using sortedArrayUsingDescriptors? I'm confused how I would go about sorting this. I don't entirely understand NSDictionary objects but I did some searching and a lot of people recommended using…
MrHappyAsthma
  • 6,332
  • 9
  • 48
  • 78
0
votes
1 answer

Accessing NSNumber objects in NSArray

I have this: NSArray *tags = [NSArray arrayWithObjects: [NSNumber numberWithInteger:0], [NSNumber numberWithInteger:1], [NSNumber numberWithInteger:2], …
neowinston
  • 7,584
  • 10
  • 52
  • 83
0
votes
2 answers

Error passing NSNumber to UInt32

I am trying to pass a NSNumber into a UInt32 variable, it seems to work but when I go to log the UInt32's value I get stuck. this is what my code looks like. if ([methodName isEqualToString:@"Manu"]) { cacheNumber = [cacheValue…
C.Johns
  • 10,185
  • 20
  • 102
  • 156
0
votes
0 answers

trouble retrieving the content from NSNumber

Sounds like a silly question. I'm trying to retrieve the content from an variable defined as a NSNumber which is read from a mutableArray: NSNumber * nsnMoneyPerMonth; nsnMoneyPerMonth=[[[myTableData objectAtIndex:0] …
NJUHOBBY
  • 850
  • 3
  • 10
  • 30
0
votes
1 answer

What is the correct way for quering a NSNumber in a NSArray within CoreData?

I have a Entity with a column of type ID named "responsibleUsers". In this column I store an Array containing NSNumbers. I want to fetch all objects of this entity, that match my current User. Therefore i create following predicate: [NSPredicate…
Dominic Sander
  • 2,714
  • 1
  • 18
  • 29
0
votes
1 answer

Using converted NSNumber to NSString returns EXC_BAD_ACCESS

I have built one 'deep' NSMutableDictionary that contains parsed XML data along with other relevant information that I can pass from one view controller to another. The NSMutableDictionary contains mostly NSStrings but also another…
esreli
  • 4,993
  • 2
  • 26
  • 40
0
votes
1 answer

error converting from plist/dictionary to NSNumber

I have a plist file that contains some default values, My goal is to copy these value in an object at runtime, Half the values are fine, the other are set to nonsense ^^…
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
0
votes
2 answers

NSNumber doubleValue method returns null in objective C (IOS)

I am doing some iOS learning and I have an NSNumber which appears to be in order but when I ask for the doubleValue of it, I get null. [stack addObject: [NSNumber numberWithDouble:operand]] id topOfStack = [stack lastObject]; if([topOfStack…
Kardasis
  • 901
  • 12
  • 20
0
votes
1 answer

Copying array of NSNumber

I'm quite new in Objective-c leaning so if my question is too stupid, please don't kill me ^^ There's my problem : *Architecture : * I have an objet : Guest with a property : listOfPricePaidByGuest This property is an array of NSNumber. All the…
Pwyll28
  • 3
  • 4
-1
votes
2 answers

NSNumber out of scope

I am having trouble figuring out why my NSNumber is considered out of scope. Here is a simple version of my code: viewController.m NSNumber *mean; [statistics calculateMean:mean]; NSLog(@"%@ is the mean", mean); //^on this line I get the error:…
exolaris
  • 27
  • 3
  • 9
-1
votes
1 answer

Objective-C, passing float as parameter

I found this problem, which is very weird. - (void)imageMove:(float)xx y:(NSInteger)yy { NSLog(@"xx=%f,----yy=%d",xx,yy); } when I call this function: [self imageMove:50 y:50]; the log shows: xx=0.000000,----yy=50
droughtrain
  • 257
  • 1
  • 4
  • 18
-1
votes
1 answer

How display the number of decimal places is uncertain float NSNumber to UILabel as in json?

I have an NSNumber object from json. I want to convert to NSString for display, but the result is weird. NSNumber *num = @(98.9); NSString *numString = [num stringValue];// output 98.90000000000001 The JSON I got from the server is …
dacai
  • 1
  • 2
-1
votes
1 answer

NSNumber's stringValue print other strings what we don't want

(lldb) po [@(70.033) stringValue] 70.033 (lldb) po [@(80.138) stringValue] 80.13800000000001 (lldb) po [@(70.138) stringValue] 70.13800000000001 (lldb) po [@(100.01) stringValue] 100.01 (lldb) po [@(90.03) stringValue] 90.03 …
-1
votes
2 answers

What is the Use of "NSNumber numberWithInt" in Xcode

i'm retrieving data from server - where the NS Number used contains BOOL value in database format. but when i try to use TRUE or FALSE , it doest allow to do. - i'm a Beginner of Xcode. for (unsigned int i =0;…
Suresh Mopidevi
  • 919
  • 3
  • 9
  • 24