diff --git a/iphone/Maps/Classes/SearchVC.mm b/iphone/Maps/Classes/SearchVC.mm index 8781ced94a..6c41da179e 100644 --- a/iphone/Maps/Classes/SearchVC.mm +++ b/iphone/Maps/Classes/SearchVC.mm @@ -163,10 +163,18 @@ static void OnSearchResultCallback(search::Result const & res, int queryId) { if (indexPath.row < m_results.size()) { - if (m_results[indexPath.row].GetResultType() == search::Result::RESULT_FEATURE) + search::Result const & res = m_results[indexPath.row]; + switch(res.GetResultType()) { - g_showRectF(m_results[indexPath.row].GetFeatureRect()); + // Zoom to the feature + case search::Result::RESULT_FEATURE: + g_showRectF(res.GetFeatureRect()); [self.navigationController popViewControllerAnimated:YES]; + break; + + case search::Result::RESULT_SUGGESTION: + [(UISearchBar *)self.navigationItem.titleView setText: [NSString stringWithFormat:@"%s ", res.GetSuggestionString()]]; + break; } } } diff --git a/search/result.cpp b/search/result.cpp index b6ed717879..fed481f355 100644 --- a/search/result.cpp +++ b/search/result.cpp @@ -66,10 +66,10 @@ double Result::GetDirectionFromCenter() const return m_directionFromCenter; } -string Result::GetSuggestionString() const +char const * Result::GetSuggestionString() const { ASSERT_EQUAL(GetResultType(), RESULT_SUGGESTION, ()); - return m_suggestionStr; + return m_suggestionStr.c_str(); } } // namespace search diff --git a/search/result.hpp b/search/result.hpp index ae6eb9487c..7f43ca4b21 100644 --- a/search/result.hpp +++ b/search/result.hpp @@ -40,8 +40,8 @@ public: // Direction from thethe center of the screen in radians, if GetResultType() == RESULT_FEATURE. double GetDirectionFromCenter() const; - // String writo in the search box. - string GetSuggestionString() const; + // String to write in the search box. + char const * GetSuggestionString() const; private: string m_str;