Всплывающее окно UIkeyboard с верхним полем uitext (картинка включена) - PullRequest
2 голосов
/ 28 июня 2011

Я пытаюсь добиться такого типа эффекта, когда нажимается кнопка и появляется всплывающая панель, а над ней появляется поле uitext. Пожалуйста, смотрите изображение прилагается. Может кто-нибудь направить меня вправо о том, как я могу это сделать? Спасибо.

enter image description here

1 Ответ

2 голосов
/ 28 июня 2011
  1. Используйте UIToolbar или UIActionSheet

  2. Настройка textField как inputAccessoryView для клавиатуры.

    UIToolbar* keyboardDoneButtonView = [[UIToolbar alloc] init];
    keyboardDoneButtonView.barStyle = UIBarStyleBlack;
    keyboardDoneButtonView.translucent = YES;
    keyboardDoneButtonView.tintColor = nil;
    [keyboardDoneButtonView sizeToFit];
    UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(30, 10, 260, 30)];
    [keyboardDoneButtonView setItems:[NSArray arrayWithObjects:textField, nil]];
    
    masterTextField.inputAccessoryView = keyboardDoneButtonView;
    
    // where masterTextField is the textField is the one you tap, and the keyboard rises up along with the small textField.
    
    masterTextField.returnKeyType = UIReturnKeyDone;
    
    [masterTextField setKeyboardType:UIKeyboardTypeDefault];
    

Обновление:

Для кнопки введите вышеуказанный код в (IBAction) кнопки. И вместо masterTextField создайте UIView и добавьте его в качестве SubView к вашему представлению.

...