看板 MacDev 關於我們 聯絡資訊
小弟正在學習如何寫iPhone app 可是遇到了點問題@@ 我現在想要做的事情是: 按下一個按鈕,會在TableView中把Cell.AccessoryView=UITextField 可是想要讓這個UITextField直接取得焦點,好讓鍵盤自動跑出來 可是怎麼試都試不出來@@ 以下是程式片段: UITableViewCell *addCell = [tableView cellForRowAtIndexPath:indexPath]; UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(0, 0, 300, 22)] autorelease]; textField.placeholder = @"Enter you wanna add."; textField.enabled = YES; addCell.accessoryView = textField; [addCell.accessoryView becomeFirstResponder]; [textField addTarget:self action:@selector(saveIt:) forControlEvents:UIControlEventEditingDidEndOnExit]; 不知道是哪邊寫錯了@@ 再請各位大大指點一番~感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.112.195.94