// // SearchViewController.m // redstar // // Created by admin on 15/12/2. // Copyright © 2015年 ZWF. All rights reserved. // #import "SearchViewController.h" @interface SearchViewController () @end @implementation SearchViewController - (void)viewDidLoad { [super viewDidLoad]; UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; [customLab setTextColor:[UIColor whiteColor]]; [customLab setText:self.customStr]; customLab.textAlignment = NSTextAlignmentCenter; customLab.font = [UIFont boldSystemFontOfSize:19]; self.navigationItem.titleView = customLab; UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; backBtn.frame = CGRectMake(0, 0, 30, 44); [backBtn setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal]; [backBtn addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn]; self.navigationItem.leftBarButtonItem = backItem; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.navigationController.navigationBar.hidden = NO; self.tabBarController.tabBar.hidden = YES; } #pragma mark - Prative Methods // 返回上一页面 - (void)doBack:(UIBarButtonItem *)sender { [self.navigationController popViewControllerAnimated:YES]; } /* #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