这可能是一个简单的错误,但我似乎无法找出错误的问题所在Unknown type name 'TransportViewController'
。我正在尝试将 2double
值的 xCoor 和 yCoor 传递给我的第二个视图,即 TransportViewController。这是我的代码:
TransportViewController *xCoor;
TransportViewController *yCoor;
@property (retain, nonatomic) TransportViewController *xCoor;
@property (retain, nonatomic) TransportViewController *yCoor;
这 4 行给了我错误
MapViewController.h 文件
#import "TransportViewController.h"
@interface MapViewController : UIViewController{
TransportViewController *xCoor;
TransportViewController *yCoor;
}
@property (retain, nonatomic) TransportViewController *xCoor;
@property (retain, nonatomic) TransportViewController *yCoor;
MapViewController.m 文件
#import "TransportViewController.h"
@implementation MapViewController
@synthesize xCoor;
@synthesize yCoor;
.
.
.
- (IBAction) publicTransportAction:(id)sender{
TransportViewController *view = [[TransportViewController alloc] initWithNibName:nil bundle:nil];
self.xCoor = view;
self.yCoor = view;
xCoor.xGPSCoordinate = self.mapView.gps.currentPoint.x;
yCoor.xGPSCoordinate = self.mapView.gps.currentPoint.y;
[self presentModalViewController:view animated:NO];
}
TransportViewController.h 文件
#import "MapViewController.h"
@interface TransportViewController : UIViewController<UITextFieldDelegate>
{
double xGPSCoordinate;
double yGPSCoordinate;
}
@property(nonatomic)double xGPSCoordinate;
@property(nonatomic)double yGPSCoordinate;
@end