我想触摸右上角的UIBarButtonItem
,然后推送新的viewController。所以,代码:无法在包中加载NIB:'NSBundle ... with name'chosenCountry''
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(insertNewObject)];
self.navigationItem.rightBarButtonItem = addButton;
和方法insertNewObject
是:
-(void)insertNewObject{
chosenViewController *chosenCountry = [[chosenViewController alloc]initWithNibName:@"chosenCountry" bundle:nil];
//self.chosenViewController = chosenCountry;
[self.navigationController pushViewController:chosenCountry animated:YES];
}
但XCode中有一个错误,当我运行“捆绑无法加载NIB: '一个NSBundle ...(加载)'与名称'chosenCountry'' 我该如何解决它? 谢谢!
你有一个名为'chosenCountry'一个XIB文件? – Larme
我认为你的viewconrtoller名称是selectedViewController.try这个chosenViewController –
@Larme我不知道,我拖动一个新的视图控制器在storyboard中,并将其设置在selectedViewController类中。我该怎么办?非常感谢你 – Shucheng