繁体   English   中英

如何使用ViewController设置InputView

[英]How to Set InputView with ViewController

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;

请检查情节提要名称。 这是“键盘”或其他名称。 您已将bundle写入nil但应该为[NSBundle mainBundle]

NewViewController * myViewController = [[UIStoryboard storyboardWithName:@"Keyboard"  bundle:nil] instantiateViewControllerWithIdentifier:@"NewView"];

检查一下:

NewViewController *vc =[[UIStoryboard storyboardWithName:@"MainStoryboard"
                               bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"NewView"];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM