当前位置:网站首页>Short video system source code, click the blank space of the screen, the keyboard does not automatically stow

Short video system source code, click the blank space of the screen, the keyboard does not automatically stow

2022-07-04 22:18:00 Cloudleopard network technology

Short video system source code , Click on the blank space of the screen and the keyboard will not be automatically stowed

#import <UIKit/UIKit.h>
 
typedef void(^resignFirstResponderBlock)(BOOL hided);
 
@interface UITextField (hideKeyBoard)
// Delay logout of the first responder 
-(BOOL)resignFirstResponder:(resignFirstResponderBlock)block;
@end

#import "UITextField+hideKeyBoard.h"
 
@implementation UITextField (hideKeyBoard)
 
/** *  Delay logout of the first responder  * * @param block  Events executed after delay  * * @return  Judge  */
-(BOOL)resignFirstResponder:(resignFirstResponderBlock)block{
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
    
 
        double delayInSeconds = 0.1;
        dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
        dispatch_after(popTime, dispatch_get_main_queue(), ^{
    
            [self resignFirstResponder];
 
            block(YES);
        });
        
    });
    return YES;
}
 
@end

The above is the source code of short video system , Click on the blank space of the screen and the keyboard will not be automatically stowed , More content welcome to follow the article

原网站

版权声明
本文为[Cloudleopard network technology]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207042146456343.html