Ios-andriod Baidu Map Imitation Baidu takeout-hungry-Choose my address-poi search/

Source: Internet
Author: User

Http://zanderzhang.gitcafe.io/2015/09/19/iOS-Andriod Baidu Map Imitation Baidu takeout-hungry-Choose my address-poi search/

Baidu Takeout Select delivery address: hungry? Choose the shipping address:

Baidu Map API website

The first figure is to put a uiimageview in the middle of the mapview, and then we drag the map at the bottom of the run.

-(void) addmiddleimage{

Uiimageview *imav=[uiimageview New];

Imav.center=_mapview.center;

Imav.bounds=cgrectmake (0, 0, 24, 36);

Imav.image=[uiimage imagenamed:@ "Poi_icon"];

[Self.view Addsubview:imav];

}

Take the center point of the screen, which is the coordinates of Uiimageview:

geo.reversegeopoint=mapstatus.targetgeopt;

Geo is bmkreversegeocodeoption *geo; Move completion calls:

-(void) mapstatusdidchanged: (Bmkmapview *) mapview{

Bmkmapstatus *mapstatus=[mapview Getmapstatus];

geo.reversegeopoint=mapstatus.targetgeopt;

[_geosearcher Reversegeocode:geo];

NSLog (@ "mapstatusdidchanged");

}

The callback function obtains the anti-compilation result and the perimeter result.poilist:

-(void) Ongetreversegeocoderesult: (Bmkgeocodesearch *) Searcher Result: (Bmkreversegeocoderesult *) result ErrorCode: ( Bmksearcherrorcode) error{

[Geoarr removeallobjects];

[Geoarr addObjectsFromArray:result.poiList];

if (Result.poiList.count) {

Bmkpoiinfo *info=result.poilist[0];

_city=info.city;

}

[_bottomtable Reloaddata];

}

The second figure , I started using the online suggestion query , later found this poi search better use point, it has three kinds, I use the poi in the city search :

Start Search:

Bmkpoisearch =[[bmkpoisearch Alloc]init];

Bmkpoisearch.delegate = self;

Bmkcitysearchoption *option=[bmkcitysearchoption New];

Search in the city

Option.city =city;

Option.keyword = SearchText;

[Bmkpoisearch poisearchincity:option];

Callback returns:

-(void) Ongetpoiresult: (bmkpoisearch) Searcher Result: (Bmkpoiresult) Poiresult ErrorCode: (Bmksearcherrorcode) Errorcode{[suggestionsearcharr Removeallobjects];

[Suggestionsearcharr addObjectsFromArray:poiResult.poiInfoList];

[_suggestiontable Reloaddata];} `

In the poiresult there is poiinfolist, the member is Bmkpoiinfo, the same as the first figure.

Andriod is similar to this, the function is different. Friends who need demo can stay in the mailbox.

Ios-andriod Baidu Map Imitation Baidu takeout-hungry-Choose my address-poi search/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.