zoukankan      html  css  js  c++  java
  • IOS 回收键盘通用代码

    感觉IOS的键盘回收好累,所以封装了一个通用一点的方法

    -(IBAction)spbResignFirstResponder:(id)sender
    {
        //    NSLogObj(sender);
        if (sender == NULL || [sender isKindOfClass:[UITapGestureRecognizer class]]) {
            if (self.view != NULL && self.view.subviews != NULL && self.view.subviews.count > 0) {
                for (UIView *item in self.view.subviews) {
                    if ([item isKindOfClass:[UITextField class]] || [item isKindOfClass:[UITextView class]]) {
                        UITextField *textField_item = (UITextField *)item;
                        [textField_item resignFirstResponder];
                    }
                    
                    [self spbResignFirstResponder:item];
                }
            }
        }else if ([sender isKindOfClass:[UIView class]]) {
            UIView *view_item = sender;
            if ([view_item isKindOfClass:[UITextField class]] || [view_item isKindOfClass:[UITextView class]]) {
                [view_item resignFirstResponder];
            }
            
            if (view_item.subviews != NULL && view_item.subviews.count > 0) {
                for (UIView *item in view_item.subviews) {
                    [self spbResignFirstResponder:item];
                }
            }
        }
    }
  • 相关阅读:
    关于git
    关于 素材,设计
    utiles
    sqlite
    蓝牙
    一个简单的Maven小案例
    【日志卡住不动】Registering current configuration as safe fallback point
    一分钟部署nacos
    生产日志文件太大NotePad++无法打开
    idea 安装 codota 插件
  • 原文地址:https://www.cnblogs.com/anxin1225/p/3951605.html
Copyright © 2011-2022 走看看