方案1、
SupermartAddViewController 里面写上
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
在调用 SupermartAddViewController的地方写:
SupermartAddViewController *saVC = [[SupermartAddViewController alloc] initWithNibName:@"SupermartAddViewController" bundle:nil];
这里的SupermartAddViewController 是SupermartAddViewController.xib
方案2、选中你的xib文件然后把xcode的右边栏工具窗口打开在File inspector 中下面有个target membership 确保你的选择框是选择上的