-(Void) viewdidload {[Super viewdidload]; // do any additional setup after loading the view. self. mapview = [[mkmapview alloc] initwithframe: Self. view. bounds]; self. mapview. maptype = mkmaptypestandard; self. mapview. scrollenabled = yes; // The map cannot be rotated. mapview. rotateenabled = no; self. mapview. zoomenabled = yes; self. mapview. showsuserlocation = yes; // set the latitude and longitude of the map center cllocationcoordinate2d center = {39.910650, 116.47030}; // set the map display range. The smaller the value, the clearer the mkcoordinatespan span = {0.01, 0.01}; // set mkcoordinateregion region = {center, span}; [self. mapview setregion: Region animated: Yes]; [self. view addsubview: Self. mapview]; uilongpressgesturerecognizer * longgesture = [[uilongpressgesturerecognizer alloc] initwithtarget: Self action: @ selector (longpress :)]; [self. mapview addgesturerecognizer: longgesture]; // sets the proxy self. mapview. delegate = self;}-(void) longpress :( uilongpressgesturerecognizer *) longgesture {// obtain the coordinate cgpoint postion = [longgesture locationinview: Self. mapview]; // converts a long coordinate to a coordinate point at the longitude and latitude, cllocationcoordinate2d coord2d = [self. mapview convertpoint: postion tocoordinatefromview: Self. mapview]; // create a circular covering layer object mkcircle * Circle = [mkcircle circlewithcentercoordinate: coord2d radius: 100]; // Add a single covering layer to the specified level [self. mapview addoverlay: Circle level: margin];} // mkoverlayrenderer returned by this method is used to draw the overwriting control-(mkoverlayrenderer *) mapview :( mkmapview *) mapview rendererforoverlay :( id <mkoverlay>) overlay {mkcircle * Circle = (mkcircle *) overlay; // After ios7, mkxxxrenderer is recommended to render the covering layer control mkcirclerenderer * circlerend = [[mkcirclerenderer alloc] cycle: Circle]; circlerend. alpha = 0.3; // fill color circlerend. fillcolor = [uicolor bluecolor]; // border color circlerend. strokecolor = [uicolor redcolor]; return circlerend ;} ************************* * ******************-(void) longpress :( uilongpressgesturerecognizer *) longgesture {// specify the local image to overwrite nsurl * url = [[nsbundle mainbundle] urlforresource: @ "HMT" withextension: @ "PNG"]; mktileoverlay * tileoverlay = [[mktileoverlay alloc] initwithurltemplate: [url description]; [self. mapview addoverlay: tileoverlay];} // mkoverlayrenderer returned by this method is used to draw the overwriting control-(mkoverlayrenderer *) mapview :( mkmapview *) mapview rendererforoverlay :( id <mkoverlay>) overlay {mktileoverlayrenderer * tilerender = [[mktileoverlayrenderer alloc] initwithoverlay :( mktileoverlay *) Overlay]; tilerender. alpha = 0.2; return circlerend ;}*/