ipad how to know keyboard has been hidden

孤者浪人 提交于 2019-12-23 19:58:25

问题


Im building an ipad app,

it haves some text fields that when tapped, move above the keyboard,

if a "calculate" button is tapped, keyboard and view, go down,

but if the user taps on the hide keyboard from the ipad [bottom right corner key of keyboard]

my view remains moved high,

so, how can i know programatically that the "hide keyboard" has been tapped?

thanks a lot!


回答1:


You should use the notification center for tracking the keyboard,

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(didShow) name:UIKeyboardDidShowNotification object:nil];
[center addObserver:self selector:@selector(didHide) name:UIKeyboardWillHideNotification object:nil];

//Resize your views in the below methods
- (void)didShow
{

}

- (void)didHide
{

}


来源:https://stackoverflow.com/questions/7912246/ipad-how-to-know-keyboard-has-been-hidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!