Wednesday, 18 April 2012

Add current location on map in IOS


-(void)viewWillAppear:(BOOL)animated{
    map.mapType = MKMapTypeStandard;
    map.showsUserLocation=YES;
     NSLog(@"%f%f",self.lat_task,self.long_task);
    CLLocationCoordinate2D coord = {.latitude = self.lat_task, .longitude = self.long_task};
    MKCoordinateSpan span = {.latitudeDelta0.3, .longitudeDelta0.3};
    MKCoordinateRegion region = {coord, span};
    [map setRegion:region];
    //map.delegate=self;
     MKPlacemark *mPlacemark = [[[MKPlacemark alloc] initWithCoordinate:coord    addressDictionary:nil] autorelease];
    [map addAnnotation:mPlacemark];
  

}

No comments:

Post a Comment