如何更改故事板中的“initwithNibName”?
我想用Xcode 4.2改变下面的代码。
UIViewController * example = [[ExampleViewController alloc] initWithNibName:@"ExampleViewController" bundle:nil]; 现在ExampleViewController.xib文件存在。 但我想用故事板来制作。 请帮帮我。 (我不擅长英语,对不起)
  UIStoryboard类是你的朋友: 
 UIStoryboard* sb = [UIStoryboard storyboardWithName:@"mystoryboard" bundle:nil]; UIViewController* vc = [sb instantiateViewControllerWithIdentifier:@"ExampleViewController"]; 
- 如果它仍然在自己的xib文件中,那么你不会改变任何东西。
- 如果您已经将所有内容都移动到故事板中,那么您通常不需要这样做,因为您可以使用segues在视图控制器之间进行链接。
 如果以上都不是真的,即您的视图控制器在故事板上,但没有segue连接到它,那么您需要UIStoryboard的instantiateViewControllerWithIdentifier: 文档中描述的方法。 您必须在故事板中设置标识符以使其工作。