mapabc 定位

  search = [MSearch MSearchWithKey:@"c2b0f58a6f09cafd1503c06ef08ac7aeb7ddb91a35954de1eaed83ba842976868415b07f6cc9ba71" delegate:self];


    mapView=[MTMapView mapViewWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height) Delegate:nil];



    userLocation=[mapView userLocation];

    [userLocation startLocatingWithCycleTime:10];

    [userLocation setCenterImage:[UIImage imageNamed:@"ball.png"]];

    mapView.showsUserLocation=YES;

    CGPoint userL=[userLocation getUserLocation];

     NSLog(@"-X----%f",userL.x);

    

    

    CGPoint mapcenter=CGPointMake(113.37194, 23.100397);

    CGSize mapsize=CGSizeMake(0.04f,0.03f);

    CGRect region=CGRectMake(mapcenter.x-mapsize.width, mapcenter.y-mapsize.height, mapsize.width, mapsize.height);

    

    [mapView setRegion:region animated:NO];

    [mapView setCenterCoordinate:mapcenter animated:NO];


    

    [NSTimer scheduledTimerWithTimeInterval:2.0

                                     target:self

                                   selector:@selector(handleTimer:)

                                   userInfo:nil

                                    repeats:YES];

    

   [mapView setCenterCoordinate:mapcenter animated:NO];

   

    [self.view addSubview:mapView];

    

 

}



- (void) handleTimer: (NSTimer *) timer

{

    CGPoint userL=[userLocation getUserLocation];

    NSLog(@"-X----%f",userL.x);

    

}


你可能感兴趣的:(地图)