简体   繁体   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;

Above code is for setting Nib file to Inputview, That is working, But below code is not working ... 上面的代码用于将Nib文件设置为Inputview,这是有效的,但是下面的代码不起作用...

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

self.inputView = (UIInputView*)self.view;

Please check storyboard name. 请检查情节提要名称。 It's "Keyboard" or something different. 这是“键盘”或其他名称。 You have write bundle is nil but it should be [NSBundle mainBundle] . 您已将bundle写入nil但应该为[NSBundle mainBundle]

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

Check this: 检查一下:

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

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

相关问题 如何在UItextfiled中将键盘设置为inputview - How to set keyboard as inputview in UItextfiled 如何在inputView中设置默认日期值 - How to set a default date value in a inputView 如何在iPhone中将UIPickerView设置为inputView到UITextField - How to set UIPickerView as inputView to UITextField in iPhone 如何将 keyboardAppearance 和 inputView?.backgroundColor 同时设置为深色? - How to set keyboardAppearance and inputView?.backgroundColor to dark at the same time? 如何将UIDatePicker的背景颜色设置为UITextField inputView? - How to change background color of UIDatePicker set as UITextField inputView? 如何在SWRevealViewController之前设置Viewcontroller - How to set Viewcontroller before SWRevealViewController 如何使用UIAppearance设置ViewController的backgroundColor - How to set backgroundColor of a ViewController with UIAppearance 如何将约束设置为tableView到viewController中? - How to set constraints to a tableView into a viewController? iOS 7:设置为UIDatePicker时,UITextField inputView问题 - iOS 7 : UITextField inputView issue when set to UIDatePicker 是否可以在情节提要中为文本字段设置inputView / inputAccessoryView? - Is it possible to set inputView/ inputAccessoryView for textfields in storyboard?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM