下面是我的代码,用于在出现键盘时将视图向上移动(还请注意,此视图具有CollectionView):
if isKeyboardShowing {
UIView.animate(withDuration: animationDuration, animations: {
if self.isCollectionViewBlockingInput() {
self.view.frame.origin.y = -distanceShifted
// Keyboard is shifted less because view a
当我按下屏幕上的按钮时,我需要隐藏IOS键盘。无论我怎么尝试,当我按下屏幕上的按钮时,键盘都不会消失。
// This is the button
-(IBAction)showDateView:(id)sender
// hide keyboard
[self.view endEditing:YES];
}
谢谢