Dismiss search when tapped outside.
This commit is contained in:
parent
d3d4aeea41
commit
f475c15360
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 673217287de2920d21ef84f1d6811d8250f187b4
|
Subproject commit b50115c767e7c0d412099ae169891dbb625b8c64
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
@property(assign, nonatomic) BOOL active;
|
@property(assign, nonatomic) BOOL active;
|
||||||
|
|
||||||
|
@property(nonatomic, copy) NSString *originalQuery;
|
||||||
- (void)setActive:(BOOL)active animated:(BOOL)animated;
|
- (void)setActive:(BOOL)active animated:(BOOL)animated;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
__weak id _storeObserver;
|
__weak id _storeObserver;
|
||||||
__weak id _mocObserver;
|
__weak id _mocObserver;
|
||||||
NSArray *_notificationObservers;
|
NSArray *_notificationObservers;
|
||||||
|
__weak UITapGestureRecognizer *_passwordsDismissRecognizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
@ -133,11 +134,13 @@
|
|||||||
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
|
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
|
||||||
|
|
||||||
if (searchBar == self.passwordsSearchBar) {
|
if (searchBar == self.passwordsSearchBar) {
|
||||||
|
self.originalQuery = self.query;
|
||||||
self.passwordsSearchBar.showsCancelButton = YES;
|
self.passwordsSearchBar.showsCancelButton = YES;
|
||||||
|
_passwordsDismissRecognizer = [self.view dismissKeyboardForField:self.passwordsSearchBar onTouchForced:NO];
|
||||||
|
|
||||||
[UIView animateWithDuration:0.3f animations:^{
|
// [UIView animateWithDuration:0.3f animations:^{
|
||||||
self.passwordCollectionView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
|
// self.passwordCollectionView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
|
||||||
}];
|
// }];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +148,8 @@
|
|||||||
|
|
||||||
if (searchBar == self.passwordsSearchBar) {
|
if (searchBar == self.passwordsSearchBar) {
|
||||||
self.passwordsSearchBar.showsCancelButton = NO;
|
self.passwordsSearchBar.showsCancelButton = NO;
|
||||||
|
if (_passwordsDismissRecognizer)
|
||||||
|
[self.view removeGestureRecognizer:_passwordsDismissRecognizer];
|
||||||
|
|
||||||
[UIView animateWithDuration:0.3f animations:^{
|
[UIView animateWithDuration:0.3f animations:^{
|
||||||
self.passwordCollectionView.backgroundColor = [UIColor clearColor];
|
self.passwordCollectionView.backgroundColor = [UIColor clearColor];
|
||||||
@ -152,9 +157,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
|
||||||
|
|
||||||
|
[searchBar resignFirstResponder];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
|
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
|
||||||
|
|
||||||
[searchBar resignFirstResponder];
|
[searchBar resignFirstResponder];
|
||||||
|
|
||||||
|
if (searchBar == self.passwordsSearchBar) {
|
||||||
|
self.passwordsSearchBar.text = self.originalQuery;
|
||||||
|
[self updatePasswords];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
|
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
|
||||||
|
Loading…
Reference in New Issue
Block a user