2
int thumbCount = [_totalThumbs thumbsViewNumberOfThumbs:self];
  1. _totalThumbs is a NSInteger type property.
  2. thumbsViewNumberOfThumbs is a method of type NSInteger.

I need to get the count in 'int' itself so that i can use it for further calculations. Any suggestions?

iCodes
  • 1,382
  • 3
  • 21
  • 47
  • Without seeing how and where `thumbsViewNumberOfThumbs:` is declared, I can only guess you should do `[self thumbsViewNumberOfThumbs:_totalThumbs]` instead of opposite. You can't call an instance method on its property, only on the, well, class instances. – Filip Radelic Sep 22 '12 at 12:28

3 Answers3

4

This question doesn't quite make sense.

First of all, NSInteger is not a class. It's a typedef for long long. That means, you can't use it as an Objective-C message receiver.

What you possibly want is that call this thumbsViewNumberOfThumbs: method on the object whose class implements it and assign that to an NSInteger. Or assign it to an int directly - for such a simple case, int and NSInteger are compatible types (assuming you don't want to work with such big numbers who don't fit into an int...)

2

The compiler is right: NSInteger is not a type that could possibly have methods, because it is not an id-derived type.

If you have a method that takes NSInteger as parameter, you pass it after the colon :, not as the receiver of the method.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
0
int thumbCount = [self thumbsViewNumberOfThumbs:_totalThumbs];
Rajneesh071
  • 30,846
  • 15
  • 61
  • 74