当前位置:网站首页>Uiscrollview add gestures show and hide keyboard
Uiscrollview add gestures show and hide keyboard
2022-06-24 02:30:00 【Juming 12255】
General idea : In itself textField Click the keyboard to pop up , After clicking the gesture, you view End edit , Gesture set to no, Click again textField The keyboard pops up , At this time, the notification gesture interaction is yes that will do
First, in the .h Add gesture protocol to the file <UIGestureRecognizerDelegate>
stay .m A gesture pointer is declared in the file
UITapGestureRecognizer * _gesture;
_gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hidesKeyboard)]; _gesture.enabled = NO;// The initial gesture is set to no [self.view addGestureRecognizer:_gesture]; Method of hiding keyboard
- (void)hidesKeyboard{ [self.view endEditing:YES]; _gesture.enabled = NO; }
The keyboard shows that I used notification and gesture to
Register a notice first ,
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil]; The way to complete the notification is to set the gesture to yes that will do
- (void)keyboardWillShow { _gesture.enabled = YES;
}
边栏推荐
- Leetcode838: push domino (medium)
- [tcapulusdb knowledge base] manually view the online operation of tcapulusdb
- NTP synchronization clock server server and client settings
- Mainstay of network detection - nping User Guide
- How does [lightweight application server] build a cross-border e-commerce management environment?
- Buddha's foot before examination: the second play of leetcode
- Leetcode969: pancake sorting (medium, dynamic programming)
- Designing complex messaging systems using bridging patterns
- How many graphics cards are required for cloud game servers? What should be paid attention to when purchasing servers
- Build your own cloud game server. What if the cloud game server is attacked
猜你喜欢

BIM model example

If there are enumerations in the entity object, the conversion of enumerations can be carried out with @jsonvalue and @enumvalue annotations

163 mailbox login portal display, enterprise mailbox computer version login portal

application. Yaml configuring multiple running environments
Cloudpods golang practice

2020 language and intelligent technology competition was launched, and Baidu provided the largest Chinese data set

How to fill in and register e-mail, and open mass mailing software for free

Introduction to development model + test model

Advanced BOM tool intelligent packaging function

Leetcode969: pancake sorting (medium, dynamic programming)
随机推荐
Tencent Ding Ke: the mission of Tencent security is to safeguard the beauty of digital
Case of data recovery by misoperation under NTFS file system
Gin framework: add API logging Middleware
How to formulate a domain name trademark registration scheme? What if the plan is rejected?
2021 game security industry summit: Security Co Construction and healthy development of escort industry
Where is the domain name filed? What materials are required for domain name filing?
How to build your own cloud game server and what are the building steps
What if the cloud desktop fails to connect to the server? How to use cloud desktop?
[Tencent cloud double 12 audio and video communication special session] from 9 yuan for Q4 counter attack artifact, SMS and security (New) package!
Data backup is required for manual upgrade of WordPress website program
What is a port? The most complete and strongest port number in history, collection!
Evaluation index of machine learning model
Tornado code for file download
How to handle the abnormal state of easycvr national standard cascading superior display?
[Tencent cloud load balancing CLB] cross region binding 2.0 (new version) idc-ip best practices!
How to build a video website? How much does it cost to build a video website?
Benchmarking Shopify? Similarities and differences between "two giants" of Chinese e-commerce SAAS and Weimeng
Engineer culture: why doesn't bat call the boss
How to protect your code - ollvm (1)
Echo framework: add API logging Middleware