Когда я вызываю эту функцию, она возвращает указатель вместо int. Когда я пытаюсь и NSLog возвращает значение, я получаю предупреждение «передать аргумент 1 из NSLog из несовместимого типа указателя». И если NSLog работает, он сработает.Почему эта функция возвращает указатель?
Это связано с тем, что это статический метод? Как я могу вернуть реальный int?
Я использую SDK 3.0
Вот функция вопрос:
+(int) getZoomFromExtent: (CLLocationCoordinate2D)bottomLeft
withTopRight:(CLLocationCoordinate2D)topRight
withPixelsX:(int)pixelsX
withPixelsY:(int)pixelsY
withMapContents: (RMMapContents*) contents;
Вот код .h:
#import <Foundation/Foundation.h>
#import <math.h>
#import <CoreLocation/CLLocation.h>
#import "RMTile.h"
#import "RMMapContents.h"
@interface AnnasMath : NSObject {}
+(CLLocationCoordinate2D) normalizePixelCoords:(CLLocationCoordinate2D) point;
+(RMTile)tileWithCoordinate:(CLLocationCoordinate2D)point andZoom:(int)zoom;
+(NSArray *)getTileArrayWithUpperLeft:(CLLocationCoordinate2D)upperLeft andLowerRight: (CLLocationCoordinate2D)lowerRight fromZoom:(int)bottomZoom toZoom:(int)topZoom;
+(int)getTileCountWithUpperLeft:(CLLocationCoordinate2D)upperLeft andLowerRight:(CLLocationCoordinate2D)lowerRight fromZoom:(int)bottomZoom toZoom:(int)topZoom;
+(int) getZoomFromExtent: (CLLocationCoordinate2D)bottomLeft
withTopRight: (CLLocationCoordinate2D)topRight
withPixelsX:(int)pixelsX
withPixelsY:(int)pixelsY
withMapContents: (RMMapContents*) contents;
@end
Вот начало кода .m:
#import "AnnasMath.h"
#import <Foundation/Foundation.h>
#import <math.h>
#import "TileWrapper.h"
@implementation AnnasMath
...
Я использую его следующим образом:
int zoom = [AnnasMath getZoomFromExtent:[[extent objectForKey:@"bottomLeft"]coordinate]
withTopRight:[[extent objectForKey:@"topRight"]coordinate]
withPixelsX:300
withPixelsY:300
withMapContents:t.mapVC.mapView.contents];
NSLog("About to set the zoom to %i", zoom);