目标c,iPhone开发中的“意外接口名称”是什么?

mut*_*ron 2 iphone uiviewcontroller

我使用了一个类 MapMultiController,它扩展了 UIViewController,并从我的 ListViewController 内部实例化,它也扩展了 UIViewController,如下所示:

@interface MapMultiController : UIViewController <UINavigationControllerDelegate, UINavigationBarDelegate> {
    MKMapView           *mapView;
    UISegmentedControl  *barStyleSegControl;
    bool                wasUpdated;
}
Run Code Online (Sandbox Code Playgroud)

然后这个:

MapMultiController *controller = [[MapMultiController alloc] initWithNibName:@"MapMultiController" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
Run Code Online (Sandbox Code Playgroud)

这一切以前都有效,但后来我从 ListViewController 中注释掉了分配和所有这些,并做了一些其他的事情,现在当我试图把它放回去时,它说“意外的接口名称‘MapMultiController’”,并且当然之后的一切都不起作用。

但在我看来一切都是正确的!怎么了?

Fly*_*ver 5

可能发生的情况是,在您的编辑过程中,您在 @interface 之前添加了一些代码,现在编译器不希望它找到它。不是你的代码错了,而是它在错误的地方。