gpt4 book ai didi

iphone - 用于在自定义 uitableview 单元格中输入的自定义键盘

转载 作者:行者123 更新时间:2023-12-03 21:19:18 25 4
gpt4 key购买 nike

我有一个包含 TableView 的 View (我将此 View 称为 EquationView,其 Controller 称为 EquationViewController)。 TableView 单元格是带有标签和文本字段的自定义单元格,分别代表变量及其值。当在文本字段中开始编辑时,我已经能够显示自定义键盘。

但是,我无法让击键出现在正确的单元格中,因为我无法弄清楚如何将正在编辑的文本字段的单元格的索引路径发送到自定义键盘 Controller 类。我已将 EquationViewController.h 文件包含在自定义键盘 Controller 类中,并且能够通过手动将 indexPath 设置为指定行来更改 tableview 的 textFields 中的文本。这是键盘类定义:

#import <UIKit/UIKit.h>
#import "EquationViewController.h"


@interface CustomNumberPadViewController : UIViewController {
EquationViewController *equationViewController;
}
@property (nonatomic, retain) EquationViewController *equationViewController;

-(IBAction)buttonPressed:(id)sender;

@end

我的操作方法如下所示(到目前为止):

-(IBAction)buttonPressed:(id)sender{

VariableCell *cell = (VariableCell *)[equationDetailViewController.myTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];

cell.variableValue.text = @"test";

}

这会让“test”一词出现在我在索引路径中设置的任意一行上。

所以我想知道的是,有没有办法将正在编辑其文本字段的单元格的索引路径传递/获取到我的自定义键盘 Controller 类中的操作方法?

最佳答案

为什么不将 UIViewController 设置为 UITextFields 的委托(delegate)并捕获 textFieldDidBegin: 委托(delegate)方法?

关于iphone - 用于在自定义 uitableview 单元格中输入的自定义键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6417691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com