nsnumber Questions
3
Solved
Since there is new NSNumber literals in Objective-C that you can use, for instance:
NSNumber *n1 = @1000; // [NSNumber numberWithInt:1000]
But it doesn't seem to be possible to use together with...
Bergstein asked 8/11, 2012 at 13:26
2
Solved
I have a little trouble with a progress bar since iOS 5 came out. The code below was working fine before iOS 5 but with iOS 5 the progress bar is no longer displaying the new progress that is set w...
Jacquelinejacquelyn asked 10/1, 2012 at 12:22
4
Solved
I have this little code
NSMutableArray *myArray = [[NSMutableArray alloc] init];
NSNumber *myNumber = [NSNumber numberWithDouble:752.65];
[myArray addObject:myNumber];
With this code I stor...
Spec asked 30/3, 2009 at 8:33
4
Solved
Something weird just happened.
I stored a NSNumber with an unsigned long long value in NSUserDefaults. When I retrieve it, the value just changed. It seems that system thinks the number is long lo...
Package asked 6/10, 2011 at 5:32
4
Solved
I want to make some NSNumber constants via the same style used for NSStrings in this topic. That is, I'm creating separate constants.h/.m files and importing them into classes that need to access t...
Neoplasticism asked 4/9, 2012 at 17:55
5
Solved
Latest version of Objective-C and XCode (4.4).
I have a code snippet and I cannot understand why I'm able to use some lines, let me explain :
// For understanding purpose : (NSMutableArray*)_prog...
Bodyguard asked 29/8, 2012 at 8:27
5
Solved
I am very new to Objective-C. I know C and C++ but Objective-C has quite the learning curve. Anyway, is there a shorter way (possibly by some kind of NSNumber literal if such exists) to write the f...
Gravitt asked 21/3, 2011 at 4:17
3
Solved
I want to perform some simple arithmetic on NSNumbers and preserve the type. Is this possible?
For example:
- (NSNumber *)add:(NSNumber *)firstNumber to:(NSNumber *)secondNumber;
Is my method d...
2
Solved
It's a fairly simple builtin in python for example: x = range(0,100)
How can I accomplish the same feat using objective-c methods? Surely there is something better than a NSMutableArray and a for-l...
Diamagnetic asked 28/6, 2012 at 4:47
6
Solved
I have a large NSArray containing NSNumbers like 3, 4, 20, 10, 1, 100, etc...
How do I get the total sum of all these NSNumbers (3 + 4 + 20 + 10 + 1 + 100 + etc...) as one total NSInteger?
Thank ...
Affiance asked 25/6, 2012 at 15:37
4
Solved
i try to convert a value like "898.171813964844" into 00:17:02 (hh:mm:ss).
How can this be done in objective c?
Thanks for help!
Decamp asked 11/8, 2009 at 8:18
4
Solved
on following code i'm get the errormessage: Implicit conversion of 'int' to 'NSNumber *' is disallowed with ARC.
What i'm making wrong?
<pre>
<code>
NSDictionary *results = [jsonstr...
Communitarian asked 18/5, 2012 at 10:55
3
I have an interface giving me numbers like this 0000000012345,78
So i figured out how to make a number out of them. But I need to calculate with that number and what I actually need is a decimal n...
Ga asked 1/11, 2010 at 1:17
3
Solved
I couldn't find this anywhere, so I am asking just asking to make sure. And yes, I know its basic, but I figure I'd rather get that right before I make the mistake a million times:
If I do the fol...
Highkeyed asked 7/5, 2012 at 17:39
4
Solved
I used this code to compare two NSNumber objects, but it never passed the if condition.
listItems = [appDelegate.productStatus componentsSeparatedByString:@","];
for (int i=0;i<[appDelegate.p...
Arrhenius asked 3/5, 2012 at 9:22
4
Solved
I am having a terrible time trying to do something that should be easy. I have a NSNumber value of 32025.89 seconds. I need to represent that in Hours, Minutes, Seconds. Is there a method that spit...
Malonis asked 7/10, 2009 at 0:11
3
[[self.view.window subviews] makeObjectsPerformSelector:@selector(setUserInteractionEnabled:) withObject:[NSNumber numberWithBool:NO]];
I saw this code in another question's answer ( How to disab...
Karakalpak asked 1/1, 2012 at 21:53
1
Solved
I found a bug in my app: The logic was that I was comparing two NSNumbers using "==", and I believe it used to work. But it no longer passes on iOS sdk 5, so I need to use isEqualToNumber instead.
...
Ligan asked 17/11, 2011 at 3:34
4
Solved
I seem to be encountering a strange issue in Objective-C converting a float to an NSNumber (wrapping it for convenience) and then converting it back to a float.
In a nutshell, a class of mine has ...
Epitaph asked 29/10, 2011 at 1:26
2
I want to convert string into phone number format. For example I have string in which I have value, "456897012". Now I want to convert it in phone number format like as (456)897-012.
So what ...
Ephor asked 15/9, 2011 at 3:33
4
Solved
I am trying to detect whether a NSNumber is between 0 and 255 or not. Whenever I run the app, I receive the alert view that my number is greater than 255, even when it is not. I do not have this pr...
Grotesque asked 21/8, 2011 at 20:52
1
Solved
So I was playing with something where the class type of the arg is unknown until runtime.
like this:
- (NSNumber *)doWhatever:(id)arg
{
// this ALWAYS FAILS
if ([arg isKindOfClass:[NSNumber class...
Seismoscope asked 8/8, 2011 at 3:51
3
Solved
If integers cannot be written to a dictionary and then to a .plist, but NSNumbers can is it better to use NSNumbers throughout the app, rather than needing to convert every-time saving or loading a...
Calais asked 12/7, 2011 at 10:24
1
Solved
how do I set the value of an NSNumber variable (without creating a new object) in objective-c?
Background
I'm using Core Data and have a managed object that has an NSNumber (dynamic property)
pa...
Loughlin asked 11/5, 2011 at 21:21
4
Solved
I have an iOS 4 project using Core Data. When I design the Core Data Model, the attributes have Integer 64, Integer 32, Integer 16, Decimal, Double, Float, and Boolean.
But in the generated NSMan...
© 2022 - 2024 — McMap. All rights reserved.