我希望這可以幫助你。但是這裏的條件是,你應該使用標籤爲文本字段
================================= ===============================================
cell =(UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
if (nil ==cell) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier] autorelease];
UITextField *txtview = [[UITextField alloc]
initWithFrame:CGRectMake(93.0,36.0,190.0,94.0)];
txtview.backgroundColor = [UIColor clearColor];
txtview.tag = 15;
txtview.contentInset = UIEdgeInsetsMake(5 ,0 ,0 ,0);
txtview.textColor = [UIColor colorWithRed:221.0/255.0 green:249.0/255.0
blue:250.0/255.0 alpha:1.0];
[cell.contentView addSubview:txtShout];
[txtview release];
}
UITextField *txtview = (UITextField*)[cell.contentView viewWithTag:15];
txtview.text = [NSString stringWithFormat:@"%@",strText];
============================================== ============
[mTableView reloadSections:[NSIndexSet indexSetWithIndex:2]withRowAnimation:UITableViewRowAnimationNone];
int rows = [mTableView numberOfRowsInSection:2];
int row = rows-1; //last
int lastbutonerow = rows-2;
UITableViewCell *cell = [mTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:2]];
UITextField *tf = [cell.contentView viewWithTag:15];
[tf becomeFirstResponder];
我不工作仍然失去焦點和鍵盤也許這是因爲需要將UItextField更改爲UiView,因爲UITextfield提供了一個錯誤。 – 2012-02-15 10:31:28
希望編輯的內容將幫助您 – 2012-02-15 12:20:38