Search code examples
iphoneiosmkmapviewtoolbar

Custom toolbar and search bar in MKMapView


How can I load default mapview toolbar and search bar in Iphone when I am loading mkmapview from my viewcontroller class


Solution

  • You can't get the search toolbar which you called default and the reason is that Map Application that's developed by Apple may have both (search toolbar and mapview ) separated with each others.

    So, would suggest you to use both as the separate views.

    myCustomSearchToolBar can be either the instance of your Custom search bar view Or UISearchBar.

    [containerView addSubview:myCustomSearchToolBar];
    [containerView addSubview:myMapView];
    [self.view addSubview:containerView];
    

    Go through the below blog post for creating UISearchBar.

    Building a SearchView with UISearchBar and UITableView