0
我想加载UIViewController,但直到运行时才知道类型。IOS - 加载未知类型的UIViewController
所以我有一些不同的UIViewControllers,每一个与它自己的.xib,并与 下面的代码中,的.xib正确显示,但UIViewController中,从未创建,因为 它的UIViewController的孩子,不是确切的UIViewController:
UIViewController *vc = [[UIViewController alloc] initWithNibName:[[self component] xibName] bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
它正常工作,例如,在这种特殊情况下,但显然不适合休息:
Controller1 *vc = [[Controller1 alloc] initWithNibName:[[self component] xibName] bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
我怎样才能解决呢? 谢谢!