ipad如何知道键盘已被隐藏 [英] ipad how to know keyboard has been hidden

查看:251
本文介绍了ipad如何知道键盘已被隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个ipad应用程序,

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,

但是如果用户从ipad点击隐藏键盘[右下角]键盘的键]

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?

非常感谢!

推荐答案

您应该使用通知中心来跟踪键盘,

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
{

}

这篇关于ipad如何知道键盘已被隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆