nsnumber Questions
3
Solved
First off I confess my ignorance, I've learned everything I know about Objective-C in the few months I've been working on my project. I also find it utterly frustrating how Objective-C seems to com...
1
Solved
I have a NSManagedObject subclass with an optional instance variable
@NSManaged var condition: NSNumber? // This refers to a optional boolean value in the data model
I'd like to do something whe...
Sepulture asked 27/11, 2014 at 12:36
3
I want to implement simple calculation with NSNumber.
For ex:
int a;
a=a*10;
a=a+1;
NSLog(@"%d",a);
How to do the same thing if i declare
NSNumber *a;
I want to implement the same logic wit...
Gynaecomastia asked 29/5, 2014 at 6:57
2
Solved
What is the most concise way to convert a CInt to an Int (the native integer type) in Swift? Right now I'm using:
NSNumber.numberWithInt(myCInt).integerValue
Is this the preferred approach?
Brose asked 6/6, 2014 at 22:26
1
Solved
The following method takes input from a UITextField and formats it for display. This code has worked flawlessly for years, but a problem was just reported on the iPhone 6 Plus using iOS 8.1. It hap...
Booster asked 4/11, 2014 at 17:22
9
Solved
How can I determine if a Cocoa NSNumber represents NaN (not a number)?
This emerges, for example, when I parse a string that has an invalid (non-numeric) contents.
Babette asked 5/4, 2009 at 18:24
3
NSNumberFormatter *formatNumber = [[NSNumberFormatter alloc] init];
[formatNumber setRoundingMode:NSNumberFormatterRoundUp];
[formatNumber setMaximumFractionDigits:0];
NSNumber *height = [formatNu...
3
Using currentIndex as NSNumber and saving NSNumber in NSUserDefaults.
Using currentIndex to store bookmarked page in NSUserDefaults
And this is how I am saving currentIndex in NSUserdefaults:
N...
Schizothymia asked 12/4, 2014 at 22:16
4
Solved
I have a double in an NSNumber.
double myDouble = 1363395572.6129999;
NSNumber *doubleNumber = @(myDouble);
// using [NSNumber numberWithDouble:myDouble] leads to the same result
This is where...
Grumous asked 11/4, 2014 at 17:49
2
Solved
The inY property gives an error. What is the correct syntax?
UIButton *optionButton = [UIButton buttonWithType:UIButtonTypeCustom];
NSObject* anim = @{@"target": target, @"inY": infoView.frame.siz...
Excepting asked 31/3, 2014 at 9:28
3
Solved
I got stuck in another problem again but after a long time.
This time I have database (Core Data), having an attribute of numbers which contains integer numbers like 213879,123,4,345,56567 and so....
Yokoyama asked 14/12, 2012 at 7:12
3
Solved
I have an NSNumber variable called task_id. I want to place that NSNumber variable in an NSString (post request). Here is what I have tried:
NSString *post = [NSString stringWithFormat:@"&am...
Cheeseparing asked 24/2, 2014 at 17:29
2
Solved
I realize that NSDecimalNumber inherits from NSNumber.
However, I am struggling to figure out how I can init an NSDecimalNumber from an NSNumber or how to convert an NSNumber to an NSDecimalNumber...
Choctaw asked 5/2, 2014 at 5:50
5
Solved
How do you store "int" values in an NSMutableArray or NSMutableDictionary? Chronic problems with JSON data that come in as integers.
Should I try to store these integers as NSNumber objects or jus...
Darmstadt asked 21/1, 2011 at 22:17
5
Solved
What's the difference between NSNumber and NSInteger? Are there more primitives like these that I should know about? Is there one for floats?
Bs asked 16/8, 2009 at 19:15
1
Solved
In Core Data, I have many attributes declared as Integer 64, and then accessed through NSNumber properties (this is by default).
Does it matter if I store and access these values by:
NSNumber *my...
3
Solved
Is it possible to cast a NSInteger to a NSNumber object?
I need to convert the tag of a UIImageView object to a NSNumber object because I need to pass it as an argument to a function.
Shy asked 14/3, 2012 at 7:12
4
hi i have Core Data database with numerical attributes. they are NSNumbers. Default value is 0.0 but when i try to do some NSPredicated fetch, i get "'NSInvalidArgumentException', reason: 'Invalid ...
Dianndianna asked 29/9, 2010 at 16:34
4
Solved
I accept NSString as
NSString *value = [valuelist objectAtIndex:valuerow];
NSString *value2 = [valuelist2 objectAtIndex:valuerow2];
from UIPickerView.
I want to
double *cal = value + (value2 *...
Lodie asked 21/7, 2010 at 12:34
4
Solved
I love the shorthand handling of string literals in Objective C with the @"string" notation. Is there any way to get similar behavior with NSNumbers? I deal with numbers more and it's so tedious ha...
Anglofrench asked 20/9, 2010 at 12:9
2
Solved
Is there a safe way to "convert" a CGFloat to a NSNumber ?
NSNumber has the numberWithFloat: and numberWithDouble: methods but CGFloat being defined as float or double depending on the platform, i...
Fafnir asked 12/6, 2013 at 14:9
4
Solved
So this problem has been perplexing me for way too long. I have a UIAlertView with a textField in it, and I need the value of the textField as an NSNumber. But everything I try gives me random stri...
Cchaddie asked 1/4, 2013 at 5:34
3
Solved
I am trying to take a reading off a sensor and display it as a percentage. [some value] will always be between 0 and 1.
Here is my code:
NSNumber *reading = [some value];
reading = [reading float...
Waxen asked 15/3, 2013 at 16:49
1
Solved
What's the largest value an NSNumber can store?
// ok
NSNumber *value = @(1 << 31);
// gives compiler error, so max NSNumber is 32-bit uint?
NSNumber *value = @(1 << 32);
Shapely asked 21/2, 2013 at 5:25
4
Solved
I have a JSON parser in my app, and I load the value into a detailDataSourceDict variable. When I try to get the valueForKey of the array and try to compare it to 0, it never works...
Here's my co...
Tenpin asked 17/11, 2012 at 15:38
© 2022 - 2024 — McMap. All rights reserved.