zoukankan      html  css  js  c++  java
  • 关闭和打开键盘的通知

    在ViewController.m中添加代码:

    -(void)viewWillAppear:(BOOL)animated
    {
        // 注册键盘出现通知
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
        // 注册键盘隐藏通知
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
        [super viewWillAppear:animated];
    }
    
    -(void)viewWillDisappear:(BOOL)animated
    {
        // 解除键盘出现通知
        [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
        // 解除键盘隐藏通知
        [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil];
        [super viewWillDisappear:animated];
    }
    
    -(void)keyboardDidShow: (NSNotification *)notif {
        NSLog(@"键盘打开");
    }
    
    -(void)keyboardDidHide: (NSNotification *)notif {
        NSLog(@"键盘关闭”);
    


  • 相关阅读:
    AutoLISP引线序号球
    2011年4月1日星期五
    AutoLISP绘制表格
    AutoLISP绘制玻璃门
    AutoLISPDCL对话框设计
    AutoLISP虚拟线变化图
    AutoLISP切圆动画
    盖章
    AutoLISP第一个DCL窗体
    jquery cookie插件使用
  • 原文地址:https://www.cnblogs.com/zhangyaoqi/p/4591607.html
Copyright © 2011-2022 走看看