我現在在一個應用程序上工作我需要一些標籤在桌面視圖單元格上,當用戶點擊該標籤上,然後鍵盤會顯示我們如何做,可以有人告訴我。我搜查,但他們使用通知我不想要的每個地方。如何顯示鍵盤出現在標籤觸摸在桌面視圖(iphone)
感謝
-(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)];
[email protected]"Player";
playername.delegate=self;
playername.keyboardType=UIKeyboardTypeDefault;
playername.returnKeyType=UIReturnKeyDone;
[cell.contentView addSubview:playername];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
所以你的物品在你的tableview單元格是一個可編輯的UITextField,而不是一個不可編輯的UILabel,* right *? – 2012-04-19 06:31:49
是的michael你說得對,標籤是可編輯的。 – vishiphone 2012-04-19 06:47:54
@vishiphone:如果這個_label_是可編輯的,那麼它是一個UITextField而不是UILabel? – 2012-04-19 08:03:20