awakeFromNib 被调用的场景
2016-07-14 本文已影响307人
清河湾
- (void)awakeFromNib 方法里面(这个方法需要用XIB注册才会起作用)
CCViewController *vc = [[CCViewController alloc] initWithNibName:@"CCViewController" bundle:[NSBundle mainBundle]];
如果是拖控件是在故事板里面的话
使用以下代码初始化ViewController
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
//Identifier是故事版里面设置的标识
ViewController *VC = (ViewController*)[storyboard instantiateViewControllerWithIdentifier:@"test"];
