self.view = [[[NSBundle mainBundle] loadNibNamed:@"KeyboardView" owner:self options:nil] objectAtIndex:0];
self.inputView = (UIInputView*)self.view;
上面的代码是用于将Nib文件设置为Inputview,这是有效的,但是下面的代码不起作用...
NewViewController * myViewController = [[UIStoryboard storyboardWithName:@"Keyboard" bundle:nil] instantiateViewControllerWithIdentifier:@"NewView"];
self.view = myViewController.view;
self.inputView = (UIInputView*)self.view;
答案 0 :(得分:0)
请检查故事板名称。它"键盘"或者不同的东西。您的写包是nil
但它应该是[NSBundle mainBundle]
。
NewViewController * myViewController = [[UIStoryboard storyboardWithName:@"Keyboard" bundle:nil] instantiateViewControllerWithIdentifier:@"NewView"];
检查一下:
NewViewController *vc =[[UIStoryboard storyboardWithName:@"MainStoryboard"
bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"NewView"];