What you need to do is creating another UIView and put the UISearchBar and your UIButton "Settings" right to it. Then add the new composite UIView instead of self.searchBar directly.
Here is an example:
UISearchBar *_searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 230, SEARCHBAR_HEIGHT)];
_searchBar.barStyle = UIBarStyleBlack;
_searchBar.delegate = self;
UIButton *_button = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100, BUTTON_HEIGHT)];
UIView *searchBarView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, SEARCHBAR_WIDTH, SEARCHBAR_HEIGHT)];
[searchBarView addSubview:_searchBar];
[searchBarView addSubview:_button];
self.navigationItem.titleView = searchBarView;