问题描述
我正在尝试使用其他XIB加载视图控制器,但由于某些未知原因,似乎根本没有加载它。
通常代码是这样的:
WorkflowViewController * workflowViewController = [[WorkflowViewController alloc] init];
[self.navigationController pushViewController:workflowViewController
动画:是];
[workflowViewController版本];
现在我想用相同的控制器加载另一个xib,所以我尝试了:
WorkflowViewController * workflowViewController = [[WorkflowViewController alloc] initWithNibName:@ Workflow
捆绑包:[NSBundle mainBundle]];
[self.navigationController pushViewController:workflowViewController
动画:是];
[workflowViewController版本];
但这绝对不起作用!没有错误,没有警告,并且没有加载xib。
关于为什么这样做以及如何解决的任何想法?
谢谢!
- 汤姆
我通过创建另一个控制器和另一个视图解决了该问题。然后将所有内容重新链接在一起。似乎视图已绑定到控制器,没有任何东西可以更改它...
I'm trying to load a view controller with a different XIB, but for some unknown reasons it seems that it does not load it at all.
Usually my code is something like this:
WorkflowViewController *workflowViewController = [[WorkflowViewController alloc] init];
[self.navigationController pushViewController:workflowViewController
animated:YES];
[workflowViewController release];
And now I want to load another xib with the same controller so I tried:
WorkflowViewController *workflowViewController = [[WorkflowViewController alloc] initWithNibName:@"Workflow"
bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:workflowViewController
animated:YES];
[workflowViewController release];
But it does absolutely nothing! No errors, no warnings, and no xib loaded. Only a blank interface is pushed to the navigation controller :/
Any ideas about why it does so and how to fix it?
Thanks!
- Tom
I fixed the problem by creating another controller and another view. Then linked all the stuff back together. It seemed like the views was binded to the controller and nothing was able to change it...
这篇关于使用initWithNibName绝对不会改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!