问题
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