在NavigtionBar上创建搜索框UISearchBar
self.searchEpisdose = [[UISearchBaralloc]initWithFrame:CGRectMake(60,25,200,30)];
self.searchEpisdose.placeholder =@"请输入要搜索的关键字";
self.searchEpisdose.barTintColor = [UIColorgrayColor];
self.searchEpisdose.layer.cornerRadius =15;//设置圆角
self.searchEpisdose.delegate =self;//设置代理
UIView * titleView = [[UIViewalloc]initWithFrame:CGRectMake(50,25,220, 30)];//创建titleView
[titleView addSubview:self.searchEpisdose];
self.navigationItem.titleView =self.searchEpisdose;//将创建搜索框sreachBar指定给titleView