How to hide inputAccessoryView without dismissing keyboard

后端 未结 11 1160
挽巷
挽巷 2021-01-02 02:49

I am using a toolbar in the inputAccessoryView property of a textView. When the keyboard shows, it displays the toolbar as expected. When the device is rotated I want to rem

11条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 03:36

    myTextView.inputAccessoryView = nil;
    [myTextView reloadInputViews];
    

    This removes the toolbar from the view and reloads the view. This way you don't need to call resignFirstResponder and becomeFirstResponder. Additionally, this will still keep your cursor placement and content.

提交回复
热议问题