mkmapview

How to set MKPinAnnotation so that bottom of image points to location instead of center of image

和自甴很熟 提交于 2019-12-14 03:12:32
问题 How can I move the pin image so that the bottom of the image points to the location (like the default pin). Currently the center of the image points to that location (San Francisco). 回答1: You'll need to calculate the number of pixels to offset and then set the centerOffset property. By default, the center point of an annotation view is placed at the coordinate point of the associated annotation. You can use this property to reposition the annotation view as needed. This x and y offset values

How to get coordinate data of selected map pin?

限于喜欢 提交于 2019-12-14 02:19:38
问题 I am trying get the coordinate of each pin I select on my map. I have an issue that every pin I select it give me the same value. In the subtitle I can see the value of each pin I select but when I equal it to Lat and Lon string value it gives me always the same value so Lat and Lon string value won't change. So please where could be my issue? - (void)viewDidLoad{ CLLocationCoordinate2D annotationCoord; annotationPoint.subtitle = [NSString stringWithFormat:@"%f & %f", annotationPoint

MKMapView removeAnnotation is not removing the selected annotation

自古美人都是妖i 提交于 2019-12-14 01:52:45
问题 When I call removeAnnotation and pass it a pointer to the annotation I had added, it is not removing the annotation... Is this because it had made a copy of the annotation when I added it? Thanks Deshawn 回答1: You could try this nsarray *oldAnnotations=[self.mapview annotations]; [self.mapview removeAnnotations:oldAnnotations]; 来源: https://stackoverflow.com/questions/6876662/mkmapview-removeannotation-is-not-removing-the-selected-annotation

Cannot get UIMapView to “zoom”/setRegion: when the map is loaded for the first time

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-14 01:03:37
问题 I have a UIViewController that loads a map with a bunch of pins already on it. There's no issues getting the pins to appear, but I can't seem to get MKMapView to execute setRegion when the user first reaches the mapView. I've tried putting the code in every possible method that could work, viewDidLoad , viewWillLoad , mapViewWillStartLoadingMap , mapViewDidFinishLoadingMap , etc., to no avail. And yet, it WILL "zoom" to the designated region if I return to the previous viewController and then

Is there any way to get the lat long of MKMapView of touch position - iPhone SDK

…衆ロ難τιáo~ 提交于 2019-12-14 00:25:10
问题 How to get the latitude and longitude of touch position on map view? I want to drop a pin where user touches just like google's javascript API does. Is it possible in iphone SDK? Tutorial would be a great help. 回答1: MKMapView has a method, - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view that can be used to get the longitude and latitude that any specified point would fall on. To get the touch position, if you're fine with limiting yourself to iOS 3.2

multiple regionDidChangeAnimated calls - what gives?

泪湿孤枕 提交于 2019-12-13 20:10:49
问题 I have a MKMapView inside a UITableView as a custom cell (don't ask ;) - don't know if it matters really), for which I register a regionDidChangeAnimated delegate method. This method gets called three times when the UITableView is loaded - once with the actual region and then two more times with a region that is way off. In the simulator, I consistently get a region with center (+37.43997405, -97.03125000). On the device, it seems to depend on the location reported by the location manager,

Creating Custom Call out View

拟墨画扇 提交于 2019-12-13 18:31:03
问题 I'm trying to add a view when I click in a pin, but appears only the title and subtitle and not the view that I did add. Here is my code -(void) inserirMapa { AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate]; NSMutableArray *pins = [[NSMutableArray alloc]init]; //array de Annotations for(int iCnt = 0; iCnt < [_listaPins count]; iCnt++) { Pin *pin = (Pin *) [_listaPins objectAtIndex:iCnt]; CLLocationCoordinate2D start; start.latitude = pin.place.latitude;

Read current location name using Map View in iPhone

荒凉一梦 提交于 2019-12-13 17:12:51
问题 I read the current location's latitude and longitude values and then pin that location in iPhone successfully. Now I want to read that place name using this latitude and longitude values. I used the following code to read the find the current location: - (void)mapView:(MKMapView *)mapView1 didUpdateUserLocation:(MKUserLocation *)userLocation{ CLLocation *whereIAm = userLocation.location; NSLog(@"I'm at %@", whereIAm.description); latitude = whereIAm.coordinate.latitude; longitude = whereIAm

Swift 3.0 Pin Color Annotation Not Changing in MapView

谁说我不能喝 提交于 2019-12-13 15:50:15
问题 I am interested in changing the pin color of an annotation based on a case scenario. In one function, I have an array sent that determines what color the pin annotation is. Thus far, I have set a subclass called ColorPointAnnotation which will determine the pinColor. Then, in the switch statement, I set the ColorPointAnnotation for the annotation. And in the viewForAnnotation, I place the new annotation with the color. From my understanding of annotations from documentation, that is all that

How to navigate to ViewController in Xamarin iOS on RowSelected event

血红的双手。 提交于 2019-12-13 15:13:11
问题 I am having a TableView on my home screen which is inside a Navigation Controller. Now, when a row is selected, I want to show a MapView. I want to get access to the Navigation Controller and push a MapViewController into it. How can i achieve this? public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { } 回答1: I assume your RowSelected method is in your UITableViewController , right? In this case, it's easy, as you can access the NavigationController property