//
|
// PBIssueSearchController.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2018/8/13.
|
// Copyright © 2018年 ProBIM. All rights reserved.
|
//
|
|
#import "PBIssueSearchController.h"
|
|
@interface PBIssueSearchController ()<UISearchBarDelegate>
|
@property (nonatomic, strong) UISearchBar *searchBar;
|
@property (nonatomic, strong) UIButton *maskBtn;
|
@end
|
|
@implementation PBIssueSearchController
|
|
- (void)viewDidLoad {
|
[super viewDidLoad];
|
[self setupNav];
|
}
|
- (void)setupNav {
|
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
|
self.view.backgroundColor = [UIColor whiteColor];
|
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"whileNav"] forBarMetrics:UIBarMetricsDefault];
|
self.searchBar = [[UISearchBar alloc] init];
|
self.searchBar.placeholder = @"输入问题标题";
|
self.searchBar.delegate = self;
|
self.searchBar.returnKeyType=UIReturnKeySearch;
|
self.searchBar.searchBarStyle = UISearchBarStyleMinimal;
|
self.navigationItem.titleView = self.searchBar;
|
[self.searchBar setShowsCancelButton:YES];
|
// UIButton *cancelBtn = [self.searchBar valueForKey:@"cancelButton"];
|
// self.cancelBtn = cancelBtn;
|
self.navigationItem.hidesBackButton = YES;
|
[self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.view);
|
make.left.right.bottom.equalTo(self.view);
|
}];
|
}
|
//- (void)setupNav {
|
// self.searchText = @"";
|
// self.view.backgroundColor = [UIColor whiteColor];
|
// self.navigationItem.hidesBackButton = YES;
|
// self.searchBar = [[UISearchBar alloc] init];
|
// self.searchBar.searchBarStyle = UISearchBarStyleMinimal;
|
// self.searchBar.placeholder = @"搜索问题";
|
// self.searchBar.delegate = self;
|
// self.navigationItem.titleView = self.searchBar;
|
// [self.searchBar becomeFirstResponder];
|
//
|
// UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(cancelAction)];
|
// self.navigationItem.rightBarButtonItem = cancelItem;
|
//
|
// self.countL = [UILabel z_labelWithText:@"搜索结果" Color:DescColor isBold:NO Font:16];
|
// self.countL.frame = CGRectMake(20, 0, self.view.width - 40, 40);
|
// [self.view addSubview:self.countL];
|
// self.countL.hidden = YES;
|
//
|
// CGFloat insetBottom;
|
// if (IS_IPHONE_X) {
|
// insetBottom = 34.f;
|
// }else {
|
// insetBottom = 0.f;
|
// }
|
// self.tableView.mj_footer.ignoredScrollViewContentInsetBottom = insetBottom;
|
//}
|
|
#pragma mark - UISearchBarDelegate
|
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
|
[self.searchBar resignFirstResponder];
|
[self.navigationController popViewControllerAnimated:YES];
|
}
|
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
|
NSString *search = [searchBar.text stringByReplacingOccurrencesOfString:@" " withString:@""];
|
if ([search isEqualToString:@""]){
|
return;
|
}
|
[self loadIssueListWithTitle:searchBar.text];
|
[self.searchBar resignFirstResponder];
|
}
|
|
- (void)loadIssueListWithTitle:(NSString *)title {
|
if ([title isEqualToString:@""]) {
|
self.issueArrM = nil;
|
[self.tableView reloadData];
|
return;
|
}
|
self.searchText = title;
|
[self.tableView.mj_header beginRefreshing];
|
}
|
- (void)didReceiveMemoryWarning {
|
[super didReceiveMemoryWarning];
|
// Dispose of any resources that can be recreated.
|
}
|
|
/*
|
#pragma mark - Navigation
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
// Get the new view controller using [segue destinationViewController].
|
// Pass the selected object to the new view controller.
|
}
|
*/
|
|
@end
|