mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 13:46:57 +02:00
Search: Show a search bar
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
#import "RecentsDataSource.h"
|
||||
|
||||
@interface SearchViewController ()
|
||||
{
|
||||
UISearchBar* searchBar;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -21,6 +24,19 @@
|
||||
{
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
searchBar = [[UISearchBar alloc] initWithFrame:self.navigationController.navigationBar.frame];
|
||||
searchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
searchBar.showsCancelButton = YES;
|
||||
searchBar.returnKeyType = UIReturnKeySearch;
|
||||
|
||||
self.navigationItem.leftBarButtonItem = [UIBarButtonItem new];
|
||||
self.navigationItem.titleView = searchBar;
|
||||
|
||||
// This is a VC for searching. So, show the keyboard with the VC
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[searchBar becomeFirstResponder];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning
|
||||
@@ -59,4 +75,16 @@
|
||||
[self addMatrixSession:session];
|
||||
}
|
||||
|
||||
#pragma mark - UISearchBarDelegate
|
||||
|
||||
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user