Created
May 9, 2015 04:09
-
-
Save HackingGate/d79c36f044f8ea0e802e to your computer and use it in GitHub Desktop.
Keyboard dismiss when scrollView drag.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface ScrollView <UIScrollViewDelegate,UITextFieldDelegate> { | |
UITextField *_currentTF; | |
} | |
@implementation | |
- (void)viewDidLoad { | |
yourScrollView.delegate = self; | |
yourTextField.delegate = self; | |
} | |
#pragma mark UIScrollViewDelegate | |
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { | |
[_currentTF resignFirstResponder]; | |
} | |
#pragma mark UITextFieldDelegate | |
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { | |
_currentTF = textField; | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment