Commit 63fcaf11 authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne
Browse files

local network: tap twice on navbar for show or hide search bar



Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 0527a941
...@@ -106,7 +106,12 @@ ...@@ -106,7 +106,12 @@
_searchDisplayController.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _searchDisplayController.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_searchDisplayController.searchResultsTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; _searchDisplayController.searchResultsTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
_searchBar.delegate = self; _searchBar.delegate = self;
self.tableView.tableHeaderView = _searchBar; //self.tableView.tableHeaderView = _searchBar;
//self.tableView.contentOffset = CGPointMake(0, CGRectGetHeight(_searchBar.frame)); // -> hide search bar to load
UITapGestureRecognizer *tapTwiceGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTwiceGestureAction:)];
[tapTwiceGesture setNumberOfTapsRequired:2];
[self.navigationController.navigationBar addGestureRecognizer:tapTwiceGesture];
// Active le Pull down to refresh // Active le Pull down to refresh
_refreshControl = [[UIRefreshControl alloc] init]; _refreshControl = [[UIRefreshControl alloc] init];
...@@ -399,4 +404,17 @@ ...@@ -399,4 +404,17 @@
[self performSelector:@selector(reloadTableViewPlex) withObject:nil]; [self performSelector:@selector(reloadTableViewPlex) withObject:nil];
} }
#pragma mark - Gesture Action
- (void)tapTwiceGestureAction:(UIGestureRecognizer *)recognizer
{
_searchBar.hidden = !_searchBar.hidden;
if (_searchBar.hidden)
self.tableView.tableHeaderView = nil;
else
self.tableView.tableHeaderView = _searchBar;
[self.tableView setContentOffset:CGPointMake(0.0f, -self.tableView.contentInset.top) animated:NO];
}
@end @end
...@@ -160,7 +160,10 @@ ...@@ -160,7 +160,10 @@
if (SYSTEM_RUNS_IOS7_OR_LATER) if (SYSTEM_RUNS_IOS7_OR_LATER)
_searchDisplayController.searchBar.searchBarStyle = UIBarStyleBlack; _searchDisplayController.searchBar.searchBarStyle = UIBarStyleBlack;
_searchBar.delegate = self; _searchBar.delegate = self;
self.tableView.tableHeaderView = _searchBar; //this line add the searchBar on the top of tableView.
UITapGestureRecognizer *tapTwiceGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTwiceGestureAction:)];
[tapTwiceGesture setNumberOfTapsRequired:2];
[self.navigationController.navigationBar addGestureRecognizer:tapTwiceGesture];
_searchData = [[NSMutableArray alloc] init]; _searchData = [[NSMutableArray alloc] init];
[_searchData removeAllObjects]; [_searchData removeAllObjects];
...@@ -777,4 +780,17 @@ ...@@ -777,4 +780,17 @@
tableView.backgroundColor = [UIColor blackColor]; tableView.backgroundColor = [UIColor blackColor];
} }
#pragma mark - Gesture Action
- (void)tapTwiceGestureAction:(UIGestureRecognizer *)recognizer
{
_searchBar.hidden = !_searchBar.hidden;
if (_searchBar.hidden)
self.tableView.tableHeaderView = nil;
else
self.tableView.tableHeaderView = _searchBar;
[self.tableView setContentOffset:CGPointMake(0.0f, -self.tableView.contentInset.top) animated:NO];
}
@end @end
...@@ -709,6 +709,9 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria ...@@ -709,6 +709,9 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
self.tableView.tableHeaderView = nil; self.tableView.tableHeaderView = nil;
else else
self.tableView.tableHeaderView = _searchBar; self.tableView.tableHeaderView = _searchBar;
[self.tableView setContentOffset:CGPointMake(0.0f, -self.tableView.contentInset.top) animated:NO];
} else } else
[self setupContentViewWithContentInset:YES]; [self setupContentViewWithContentInset:YES];
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment