<span style="font-family:Times New Roman;font-size:18px;">self.searchBar = [[[UISearchBar alloc] init] autorelease];
self.searchBar.barTintColor = [UIColor whiteColor];
_searchBar.frame = CGRectMake(0, 0, 200, 25);
//设置圆角
_searchBar.layer.cornerRadius = 12.5;
_searchBar.layer.masksToBounds = YES;
[_searchBar.layer setBorderWidth:0.5];
[_searchBar.layer setBorderColor:[UIColor blackColor].CGColor]; //设置边框为白色
//设置titleView
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 25)];//allocate titleView
[titleView setBackgroundColor:[UIColor whiteColor]];
[titleView addSubview:_searchBar];
self.navigationItem.titleView = titleView;
_searchBar.placeholder = @"请输入搜索内容";</span>