Setting response and the TextField View toolBar

inputView provided for display in response to View display mode is similar to the keyboard

View ToolBar inputAccessoryView for setting in response to the above

Use:

inputView View appear in response to keyboard position

inputAccessoryView set toolBar on your keyboard

 

// Create toolBar

UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, getWidth(40))];

UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:LA_BT_ME_DONE style:UIBarButtonItemStylePlain target:self action:@selector(doneTouched:)];

[toolBar setItems:[NSArray arrayWithObjects:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], doneButton, nil]];

 

_pickTextField.inputView = self.selectPickerView;

_pickTextField.inputAccessoryView = toolBar;

Guess you like

Origin www.cnblogs.com/huaida/p/12120912.html