iOS - Custom keyboard, updating text field in parent view

痞子三分冷 提交于 2019-12-25 03:45:22

问题


I am implementing a custom keyboard and need to update the original textField when buttons are touched on that keyboard.

I have tried following the answer to this question: Return Inputs to UITextfield with custom inputView but I don't find it very clear.

In statViewController I have defined my textField xValue, and created an instance of my keyboard:

DCKeyboard *dckXValue = [[DCKeyboard alloc] initWithNibName:@"DCKeyboard" bundle:nil];

The next line of the answer uses self, so I take it that it's suggesting that I should create a property of dckXValue that is a statViewController:

dckXValue.objStatViewController = self;

Again, I follow the answer through (add the @class line, create the object/property) but then in my method that catches my button presses (in DCKeyboard.m), when I reach the line:

objStatViewController.xValue.text = @"Some value";

I am getting the error "Request for member 'xValue' in something not a structure or union" when I try to compile.

Can anyone give me any hints on where I might be going wrong?

Thanks!


回答1:


It's a problem of property the text field is not a property. Try #import "StatViewController.h" in your implementation file



来源:https://stackoverflow.com/questions/7140770/ios-custom-keyboard-updating-text-field-in-parent-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!