开发者

iOS - Custom keyboard, updating text field in parent view

开发者 https://www.devze.com 2023-03-29 21:28 出处:网络
I am implementing a custom keyboard and need to update the original textField when buttons are touched on that keyboard.

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) b开发者_开发问答ut 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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消