2009-10-06 6 views
0

내 아이폰에 샘플 웹 응용 프로그램을 만드는 중입니다 ... 해당 응용 프로그램에서 기본 페이지는 로그인 페이지입니다 .... 사용자는 사용자 이름과 암호를 텍스트 필드 (UITextField)에 입력하면 확인됩니다. 프로그램.UITextField 커서 문제

내 문제는 ... 내가 (AN 창 작업처럼) 키보드를 누르면 탭 키를 사용하여 다른의 UITextField에 하나 개의 UITextField에서 커서를 이동하려는 나는 잘 모릅니다

입니다. 내가 어떻게 할 수 있니?

아무도 도와 줄 수 있습니까? 사전에

감사합니다 ........ (이 가능합니까?)

당신은 호출하여 특정의 UITextField에 포커스를 이동할 수 있습니다
+0

분명히 : UITextField를 사용하는 경우 웹 응용 프로그램이 아니라 기본 응용 프로그램입니까? – Hauke

+0

그리고 Mac OS의 iPhone 시뮬레이터에서 실행하고 있습니까? – Hauke

+0

iphone 시뮬레이터 –

답변

1

:

[myTextField becomeFirstResponder] 

당신의 UITextFieldDelegate를 구현하는 경우 당신의 클래스는 다음과 같은 메소드를 선언함으로써 "Done"키가 눌려지는 것을 처리 할 수 ​​있습니다.

/*****************************************************************************/ 
/* Handle the Done button being pressed on the keyboard for any of our  */ 
/* editable UITextFields. We either pass the keyboard focus to the next  */ 
/* text field, or we hide the keyboard.          */ 
/*****************************************************************************/ 
- (BOOL)textFieldShouldReturn:(UITextField *)xiTextField 
{   
    if (xiTextField == myAccountNameTextField]) 
    { 
    NSLog(@"Done pressed whilst in account name field, pass focus"); 
    [myPasswordTextField becomeFirstResponder]; 
    } 
    else 
    { 
    NSLog(@"No next text field, closing keyboard"); 
    [xiTextField resignFirstResponder]; 
    } 
}