0

特定のテキストフィールドが上下にある単純なiphoneアプリケーションを作成しています。問題は、シミュレーターのキーボードを介してこれらの最初のいくつかのフィールドにデータを追加するときに、実際の電話ではなくシミュレーターをまだ使用しているため、入力に使用していないキーパッドもポップアップすることです。キーパッドで非表示になっているテキストフィールドにデータを入力できなくなりました。

申し訳ありませんが、私の質問がばかげている場合は、そのためのショートカットがある可能性がありますが、私は新しいので、Google検索で何かが見つからない場合は、StackOverflowが唯一のバックオプションです:)

4

5 に答える 5

0

または、属性インスペクターから RETURN キー (DONE、GO...) を追加することもできます。

于 2014-01-24T07:08:28.647 に答える
0

おそらく、Android の「戻るボタン」のようなものを探しているのではないでしょうか。いずれにしても、Android Emulator のキーボードを閉じます。iOS シミュレーターには、そのように機能するショートカットやボタンがありません。戻るボタンでキーボードを閉じることができますが、最初にコードでUITextFieldDelegateを接続している場合に限ります。このコードを使用して、戻るボタンを「機能」させます。

于 2013-01-08T17:41:37.977 に答える
0

Use your simulator keypad for entering the user inputs and write code for moving up the textfields so that keypad doesn't hides the text fields. Connect the delegate to text fields.

I am using this for moving up and down: in view did load,

{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
 }

and the following methods

- (void) keyboardWillShow: (NSNotification*) aNotification
{    
    int position = 0;


    if ([txtfld1 isFirstResponder])
        position = 120;
    else if ([txtfld2 isFirstResponder]) position = 120;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    CGRect rect = [[self view] frame];
    rect.origin.y -= position; 
    [[self view] setFrame: rect];
    [UIView commitAnimations];

}
- (void) keyboardWillHide: (NSNotification*) aNotification

{
    int position = 0;


    if ([txtfld1 isFirstResponder])
        position = 120;
    else if ([txtfld2 isFirstResponder]) position = 120;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    CGRect rect = [[self view] frame];
    rect.origin.y += position; 
    [[self view] setFrame: rect];
    [UIView commitAnimations];
}
于 2011-12-16T07:13:07.963 に答える
0

textField Delegate を追加するだけです..そして、これはそのデリゲートメソッドです

    - (BOOL)textFieldShouldReturn:(UITextField *)textField
    {
      ["your Textfiled object Name" resignFirstResponder];
    }

上記のようにすべての textFiled を設定します。あなたのキーボードは破棄されます。Textfields を Scrollview に保持することをお勧めします。それはあなたを助けます

于 2011-12-16T07:14:19.757 に答える