我创建了一个项目,添加了一些附加到它们自己的类的ViewControllers。但现在,我只是在storyboard中添加了一个新的ViewController。然后我创建了一个新的Objective-C类(它是UIViewController的子类)。问题是,在IB中,我无法将ViewController链接到新创建的类,因为我在IB提供的列表中根本没有这个类(请参见下面的图像)。我的新类被称为MapShownViewController,但是如您在图像上看到的,它不可用。
我之前用它处理其他课程都很好用,但对于这门课不起作用。
以下是MapShownViewController.h文件:
#import <UIKit/UIKit.h>
@interface MapShownViewController : UIViewController
@end
而 MapShownViewController.m 文件:
#import "MapShownViewController.h"
@interface MapShownViewController ()
@end
@implementation MapShownViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
有人能解释一下我错在哪了吗?
MapViewController
看起来不错。 - Paul.s