gpt4 book ai didi

iphone - 如何显示键盘出现在 tableview 中的标签触摸上(iphone)

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:25:38 26 4
gpt4 key购买 nike

我现在在一个应用程序上工作,我需要在 tableview 单元格上添加一些标签,当用户点击该标签时,键盘将显示我们如何做,有人可以告诉我。我搜索了但他们使用通知的每个地方我都不想那样。

谢谢

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:                       

(NSIndexPath*)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:CellIdentifier]
autorelease];
}
cell.textLabel.text=[Players objectAtIndex:indexPath.row];

playername=[[UITextField alloc]initWithFrame:CGRectMake(10, 5, 100, 30)];
playername.placeholder=@"Player";
playername.delegate=self;
playername.keyboardType=UIKeyboardTypeDefault;
playername.returnKeyType=UIReturnKeyDone;
[cell.contentView addSubview:playername];


cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
return cell;

}

最佳答案

在您的应用中不使用 UITextField 或 UITextView 很奇怪

但如果你想要这个,你可以创建一个不可见的 UITextField 或 UITextView 来显示键盘

UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[self.view addSubview:tf];
[tf becomeFirstResponder];

因此您可以使用 UITextFieldDelegate 处理输入

关于iphone - 如何显示键盘出现在 tableview 中的标签触摸上(iphone),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10222704/

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