我的一个 Objective-C 课程有问题。
Xcode 说第 20 行有一个 Parse Issue。
+ (Boolean)hasOverlay:(KnownPoints*)points byPoint:(CGPoint)p;
KnownPoints 是一个自写的类。Xcode 显示错误出现在 '(KnownPoints*)points 部分。
添加此代码行的其他类似主题的答案:
@class KnownPoints
不起作用。
该类在计算类中调用,它使 x 和 y 坐标的纬度和经度形成一个视图。
这里的代码:(CalcMakerPos.h)
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "Journey.h"
#import "CoordRect.h"
#import "KnownPoints.h"
@interface CalcMakerPos : NSObject
+ (CGPoint)calcPosFor: (CLLocationCoordinate2D)coord WithDataFrom: (CoordRect*)rect AtView: (UIView*)view;
+ (Boolean)hasOverlay:(KnownPoints*)points byPoint:(CGPoint)p;
@end
CalcMakerPos.m
#import "CalcMakerPos.h"
#import "MinMaxCoords.h"
#import "Journey.h"
#import "KnownPoints.h"
@implementation CalcMakerPos
#pragma mark Calculate GeoCoords zu Pixeln
+ (CGPoint)calcPosFor: (CLLocationCoordinate2D)coord WithDataFrom: (CoordRect*)rect AtView: (UIView*)view{
double maxLat = [rect maxLat];
double minLat = [rect minLat];
double maxLon = [rect maxLon];
double minLon = [rect minLon];
int x = (int)((coord.longitude - minLon) / (maxLon - minLon) * view.frame.size.width);
int y = (int)((coord.latitude - minLat) / (maxLat - minLat) * view.frame.size.height);
NSLog(@"Point(%d, %d)", x,y);
return CGPointMake(x, y);
}
#pragma mark check whether point is free
+ (Boolean)hasOverlay:(KnownPoints*)points byPoint:(CGPoint)p{
BOOL isOverLay = false;
return isOverLay;
}
@end
我希望你能帮助我。
来自德国的问候
罗比字节