zoukankan      html  css  js  c++  java
  • ios 键盘弹起

    #pragma mark 键盘弹起操作

    - (void)keyboardWillShow:(NSNotification *)notification
    {
        NSDictionary *info = notification.userInfo;
        kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
        [UIView beginAnimations:@"kbmove" context:nil];
        [UIView setAnimationDelay:0.5];
        if (!iPhone5) {
            
            self.view.frame = CGRectMake(0, 0 - kbSize.height + 150, SCREEN_WIDTH, SCREEN_HEIGHT);
            
        }else
        {
            self.view.frame = CGRectMake(0, 0 - kbSize.height + 120, SCREEN_WIDTH, SCREEN_HEIGHT);
        }
        [UIView commitAnimations];
    }

    #pragma mark 键盘消失操作

    - (void)keyboardwillhidden:(NSNotification *)notification
    {
        self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    }

    - (void)createKeyboardNotification
    {
        //键盘通知
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardWillShow:)
                                                     name:UIKeyboardWillShowNotification object:nil];
        
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardwillhidden:)
                                                     name:UIKeyboardWillHideNotification object:nil];
    }

  • 相关阅读:
    5.1重磅活动:区块链免费送书
    Java 9 被无情抛弃,Java 8 直接升级到 Java 10!!
    Linux负载均衡利器(LVS)
    豌豆荚Redis集群方案:Codis
    Spring Boot Redis Cluster实战
    高性能代理缓存服务器—Squid
    Facebook分布式框架—Thrift介绍。
    Java 高级面试知识点汇总!
    (4)设计模式-建造者模式
    (3)设计模式-单例模式
  • 原文地址:https://www.cnblogs.com/A--G/p/4832803.html
Copyright © 2011-2022 走看看