IOS development of map search list display effect achieved

Implementation effect

As shown:

IOS development of map search list display effect achieved

Need to introduce high German 3D map, SDK, High German search SDK, high moral map base SDK, need to configure their high moral map AppKey and the corresponding Boundle ID.

The project demo is integrated with pod, and the demo organization framework uses the MVC design pattern. Own packaging high moral map search management class, take directly can use, use is also very simple, about this search package, explain in, which contains gitHub address.

Frame structure

IOS development of map search list display effect achieved

AddressSelectedController is the interface of address search, DDLocationReGeocode as its Model model, DDMapView is a drawing off of the map, and the overall use of MVC design patterns. Among them, the DDSearchManager file is encapsulated search management class.

The function of each part is very clear, so write the code, you will find that it is very simple, it does not seem complicated, of course, if you have to in a Controller inside, that is, maps and search, and so on, also Who cares.

Implementation process

#import < UIKit/UIKit.h> #import; < CoreLocation/CoreLocation.h> #import "DDLocationReGeocode.h" / * * callback choose is the position information of @param reGeocode position information of @param error error code * / typedef void (^DDLocationCompleteBlock) (DDLocationReGeocode *reGeocode, NSError *error); @interface AddressSelectedController: UIViewController / block @property selected callback address information (nonatomic, copy) DDLocationCompleteBlock / completeBlock; incoming longitude, anti Geographic Encoding / @property (nonatomic) CLLocationCoordinate2D currentCoordinate; @end

This interface can from the outside into the initial latitude and longitude, if the incoming initial latitude and longitude, the map will move directly to the location of the incoming and nearby points of interest search, if not into the initial latitude and longitude, the map at the current position of the user to the default location.

DDLocationCompleteBlock is a callback you select the address information of the block block callback error code DDLocationReGeocode objects reGeocode and NSError. The error code is not defined here, if there is a need to add their own.

Of course, you can also use proxy, data callback is also possible, both are very good.


Implementation of the document added to the map, tableView, to achieve their respective agent method. When moving map, query the POI point by inverse geocoding, and refresh the list after getting the interesting points.


This model is very simple, that is some data, in MVC, Model role is still very large, and here can not be fully reflected, but simply stored a bit of data, as the main data transmission.

#import < Foundation/Foundation.h> #import; < CoreLocation/CoreLocation.h> @interface: DDLocationReGeocode NSObject @property (nonatomic, copy) NSString *city @property (nonatomic, copy); NSString *cityCode; @property (nonatomic, copy) NSString *name @property (nonatomic, copy); NSString *address; @property CLLocationCoordinate2D coordinate; @end (nonatomic)

This DDMapView is also very simple, just a map, in the middle of a picture. For map package some people use a Manager as a map management class to manage the map, I am here directly with a View, which loaded a map to deal with, can be realized, don’t know which way is good, you can try.

#import < UIKit/UIKit.h> #import; < MAMapKit/MAMapKit.h> @class DDMapView; @protocol DDMapViewDelegate < NSObject> / / the first implementation of the 1 sliding map, and then execute 2 @optional / * * 1, change the map area after the completion of this interface calls (calls) @param ddMapView self @param animated (void) ddMapView: animation - * / (DDMapView * ddMapView) regionDidChangeAnimated: (BOOL) animated; / * * 2, mobile map end call this interface (calls) is @param ddMapView self * / slip behavior of @param wasUserAction user - (void) ddMapView: (DDMapView *) ddMapView mapDidMoveByUser: (BOOL) wasUserAction; @end @interface DDMapView: UIView {CLLocationCoordinate2D _centerCoordinate; / / the center point of the current map latitude and longitude} @property (n Onatomic, weak) ID < DDMapViewDelegate> delegate; / / high moral map @property (nonatomic, strong) MAMapView *mapView; / / the current location of the user @property (nonatomic) CLLocationCoordinate2D userCoordinate; (instancetype) - initWithFrame: (CGRect) frame delegate: (id< DDMapViewDelegate> delegate); / * * set the map center point coordinates @param centerCoordinate longitude coordinate @param whether animated animation - (void) setCenterCoordinate: / (CLLocationCoordinate2D) centerCoordinate animated: (BOOL) animated; / * * @return to obtain the coordinates of latitude and longitude of the center point of the map - * / (CLLocationCoordinate2D) centerCoordinate; @end

Here I will explain why _centerCoordinate as an instance variable and wrote his set and get method, a @property does not fix it, certainly not the case, the reason for this is written in order to expand its set method, add a parameter animated, the original fee so shocked it for this, there are other simple ways you know what, tell me, we learn from each other.


Implementation file, add a map, a middle image, the intermediate picture didn’t do what animation like, you need to do their own projects, I see a lot of the map will be a map of a slide, this picture beat, of course this is also possible, do a simple also can still then, the following plus what what the effect of the radar.

Code in the final description inside, Download yourself to see, welcome to make comments, do not forget to use your AppKey configuration.

Final description

This is just a small demo just, according to their actual situation of the project, you can pack more functions. I put this little demo here, and if I study together, I can communicate with