Here is the method declaration midway in Apple's documentation: Learning Objective-C: A Primer
- (void)insertObject:(id) anObject atIndex:(NSUInteger) index
Why is there no *
right after NSUInteger
. I thought all objects were pointer types and all strongly typed pointers had to have 开发者_开发问答a *
character after it.
NSUInteger
is not an object type, it is a typedef
to unsigned int
.
The only reason that you would actually want to use a *
in this context would be if you wanted to get the address of an int and store something in it. (Some libraries do this with error messaging). An example of this:
-(void) methodName: (NSUInteger *) anInt {
*anInt = 5;
}
NSUInteger a;
[obj methodName: &a]; //a is now 5
精彩评论