[英]How Can I show keyboard appears on label touch in tableview( iphone)
我現在在一個應用程序上工作我在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來處理輸入
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.