nsuinteger

Division and NSUInteger

I have some calculation that involves negative values: row = (stagePosition - col) / PHNumRow; Say stagePosition is -7 and col is 1. They are both NSInteger, including row. PHNumRow is 8. If PHNumRow is NSInteger, I get the result I expect: -1. But if PHNumRow is NSUInteger, the result is garbage. Why should it matter if the divisor...

Allocating a NSUInteger IndexBuffer

New to Objective C so pardon my stupidity,.. I am trying to retrieve my NSIndexSet by calling GetIndexes:MaxCount:IndexRange Here is my code const NSUInteger arrayCount = picturesArray.count; NSUInteger theIndexBuffer[arrayCount]; [picturesArray getIndexes:theIndexBuffer maxCount:arrayCount inIndexRange:nil]; However, in the ...

Why cocoa dont use same enum declaration style everywhere ?

I was wondering what is the rationale behind different styles of enum declaration on cocoa? Like this: enum { constants.. }; typedef NSUInteger sometype; Is the reason to use typedef to get assigments to NSUInteger to work without casting? Sometimes the typedef is either of NSInteger/NSUInteger, why not use NSInteger always? Is th...

How do I increment a NSUInteger variable?

NSUInteger wordInt = sentence.length; I want to add 1 like this -> wordInt = wordInt + 1 ; But It doesn't work. I don't know.... Please!! ...

NSString to NSUInteger

Hi all, I've got a number in a NSString @"15". I want to convert this to NSUInteger, but I don't know how to do that... Regards, dodo ...

Invalid receiver type 'NSUInteger'

I have a Core Data entity whose header file looks like this: @interface MyEntity : NSManagedObject { } @property (nonatomic, retain) NSNumber * index; @end And it's implementation file looks like this: @implementation MyEntity @dynamic index; @end Now, I have a piece of code that looks like this: NSArray* selectedObects = [myE...

Is there a way to have a NSUInteger automatically display commas in iPhone?

Like if I had 29993 would there be a way to automatically have it be displayed as 29,993? Thanks ...

Using Multiple NSUInteger enums as a parameter to a method.

Hi, I'm trying to make a method with a similar format to the setAutoresizingMask: method of NSView. I want to have someone be able to specify multiple values that i declared in my enum (NSHeightSizable | NSWidthSizable) like in autoresizing mask. How can I do this? ...

Strange conversion from NSUInteger to floats.

I have the following code: NSUInteger one = 1; CGPoint p = CGPointMake(-one, -one); NSLog(@"%@", NSStringFromCGPoint(p)); Its output: {4.29497e+09, 4.29497e+09} On the other hand: NSUInteger one = 1; NSLog(@"%i", -one); // prints -1 I know there’s probably some kind of overflow going on, but why do the two cases differ and why d...