2011-09-23 4 views
0

cell을 선택하고 그 안에 무언가를 쓰면 키보드의 return/next 버튼을 눌러 다음 cell으로 이동하고 싶습니다. 성취하려고 노력한다. 그러나 내 방법 textfieldShouldReturnbreakpoint을 배치 한 후에는 return/next 키를 눌러도 방문하지 않는 것으로 나타났습니다. 왜 누군가가 설명 할 수 있습니까?내 텍스트 필드 UITableViewCell 및 textfieldShouldReturn이 눈을 보지 못함

감사합니다.

답변

0

무엇을 의미합니까? cell. UITextFieldcell에 있고 delegateself으로 설정 한 경우에만 전화가 걸립니다.

[cell.contentView addSubview:txt];

UITextField *txt=[[UITextField alloc]initWithFrame:CellFrame]; 
text.tag=indexPath.row; 
txt.delegate=self; 
다음 확실히 textFieldShouldReturn 메소드를 호출합니다. 반환시 클릭

+0

나는 비슷한 가지고, 내가 답변으로 내 코드를 추가하는 시도하지만 8시간을 기다려야한다. 파일 소유자와 위임자와 비슷한 문제가있는 다른 사람들에게 여러 게시물을 보냈지 만 프로그래밍 방식으로 파일 소유자의 일부분을 만들려면 어떻게해야합니까? 그게 문제라도된다면? –

0
@interface WordListTableController : UITableViewController <UITextFieldDelegate> 
{ 
} 

@end 

// 표보기 셀의 모양을 사용자 정의하십시오. - (있는 UITableViewCell *)있는 tableView : (jQuery과 *)있는 tableView cellForRowAtIndexPath : (NSIndexPath *) indexPath {

static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:CellIdentifier] autorelease]; 
} 

// Configure the cell... 
UITextField *FirstField = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 130, 25)]; 
FirstField.delegate = self; 
[FirstField setTag:indexPath.row]; 
FirstField.returnKeyType = UIReturnKeyNext; 
[cell.contentView addSubview:FirstField]; 
[FirstField release]; 


return cell; 
} 


// Handle any actions, after the return/next/done button is pressed 
- (BOOL)textfieldShouldReturn:(UITextField *)textfield 
{ 
[textfield resignFirstResponder]; 

return NO; 
} 
관련 문제