// 一、根據StoryboardID(需要在Storyboard設置),通過ViewController所在的Storyboard來加載:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"FicowVC"];
// 二、通過UIViewController對應的.xib文件加載:
UIViewController *vc = [[UIViewController alloc] initWithNibName:@"FicowVC" bundle:nil];
// 三、直接加載UIViewController類:
UIViewController *vc = [[UIViewController alloc] init];
/*
注意:
loadNibNamed和initWithNibName需要加載的xib文件是不一樣的。
initWithNibName需要加載的xib文件的File Owner應改是需要加載的類,
而loadNibNamed需要加載的xib文件的File Owner為NSObject。
*/
轉載請注明出處:http://www.cnblogs.com/ficow/p/7253666.html