```
customSearchBar=[[UISearchBar alloc]initWithFrame:CGRectMake(40, 27, kSCREEN_WIDTH-60, 30)];
customSearchBar.backgroundColor = [UIColor clearColor];
[customSearchBar setBackgroundImage:[UIImage new]];
[customSearchBar setTranslucent:YES];
customSearchBar.placeholder = @"Search";
[self.view addSubview:customSearchBar];
customSearchBar.returnKeyType=UIReturnKeySearch;
[customSearchBar setTintColor:[UIColor whiteColor]];
customSearchBar.delegate = self;
//去掉searchbar背景
customSearchBar.searchBarStyle = UISearchBarStyleProminent;
//改變輸入框內(nèi)字體的顏色
UITextField *searchField = [customSearchBar valueForKey:@"_searchField"];
// Change search bar text color
searchField.textColor = [UIColor whiteColor];
searchField.layer.borderWidth = 0.6;
searchField.layer.borderColor = [UIColor whiteColor].CGColor;
searchField.layer.masksToBounds = YES;
searchField.layer.cornerRadius = 5;
searchField.backgroundColor=[UIColor clearColor];
```