当前位置:网站首页>监听iPad键盘显示和隐藏事件
监听iPad键盘显示和隐藏事件
2022-06-26 08:10:00 【may_he】
定义键盘显示事件
-(void)keyboardWillShow:(NSNotification *)notification
{
.....
}
定义输入完成后,按return键键盘隐藏
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
if([textField tag]==1)
{
[textField resignFirstResponder];
}
if(textField == editTextField)
{
[textField resignFirstResponder];
}
......
}
为虚拟键盘的右下角按钮定义事件
-(void)keyboardWillHide:(NSNotification *)notification
{
....
}
注册事件
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
头文件中必须要有:
UITextFieldDelegate
边栏推荐
- ASP. Net and Net framework and C #
- Baoyan postgraduate entrance examination interview - operating system
- Solve the problem that pychar's terminal cannot enter the venv environment
- Livevideostackcon | evolution of streaming media distribution for online education business
- Interview for postgraduate entrance examination of Baoyan University - machine learning
- Uniapp wechat withdrawal (packaged as app)
- 45. jumping game II dynamic planning DP
- Color code
- Common uniapp configurations
- Household enterprises use WMS warehouse management system. What are the changes
猜你喜欢

What are the characteristics of digital factory in construction industry

ReW_ p

StarWar armor combined with scanning target location

Opencv mouse event + interface interaction drawing rectangle polygon selection ROI

Database learning notes II

Win11 open folder Caton solution summary

Rewrite string() method in go language

Oracle database self study notes

Interview for postgraduate entrance examination of Baoyan University - machine learning

MySQL practice: 3 Table operation
随机推荐
Read excel table and render with FileReader object
The first multi platform webcast of 2021ccf award ceremony pays tribute to the winners! CCF outstanding engineer
Database learning notes I
Interview ES6
Baoyan postgraduate entrance examination interview - operating system
1010. song backtracking with total duration divisible by 60
Golang collaboration and channel usage
MySQL practice: 3 Table operation
OSPF design principles, commands take H3C as an example
Junit
Project practice: parameters of pycharm configuration for credit card digital recognition and how to use opencv in Anaconda
Arrangement and insertion structure
信息学奥赛一本通 1355:字符串匹配问题(strs)
Chapter VII (structure)
Ping An technology's practice of migrating from Oracle to ubisql
WiFi-802.11 2.4G频段 5G频段 信道频率分配表
Attention mechanism yyds, AI editor finally bid farewell to P and destroyed the whole picture
How to design API return codes (error codes)?
Chapter 3 (data types and expressions)
Yyds dry inventory executor package (executor function)