mkmapview

How to rotate MKMapView and keep the Annotation and the view don't rotate?

大城市里の小女人 提交于 2019-12-09 06:54:55
问题 I am making an MKMapView that shows the user's current location. I want to rotate the map like the Google Maps App without rotating the annotations. Im using the following code -(void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{ mapView.transform=CGAffineTransformMakeRotation(-1*newHeading.magneticHeading*3.14159/180)}; but the whole view is rotated like this image. The image of the problem in my app 回答1: You basically need to apply a the same

Custom Callout Bubble iOS

前提是你 提交于 2019-12-09 06:52:13
问题 I am developing app with mapview functionality. I want to show custom pin image on mapview, click on that open custom callout bubble with image and title. With click on that callout bubble view I would like to do some functionality. How to achieve this? Any help will be appreciated 回答1: Head over to CocoaControls for custom controls. I bet you'll find something useful for your requirement. Here are some search results from CocoaControls: Callout Bubble Popup Custom Pin Image There are already

How to update information on MKPinAnnotationView?

坚强是说给别人听的谎言 提交于 2019-12-09 06:49:25
I've had some past experience using MKMapView and MKPointAnnotation , which I used to put some pin on a map. This time I am trying to go one step further and use MKPinAnnotationView , to write a label along with some of the pins. Unfortunately, it doesn't all work as I expect. Here is what I want to do: I have a map (an MKMapView object) and when I touch it, I put a pin at the touch point, then some computation is performed and this gives me a second point on the map. I put a second pin on the map (located at the second point), on this last pin I want to put a label, say "Hello Second!", but

Controlling the animation speed of MKMapView in iOS6

梦想与她 提交于 2019-12-09 05:37:59
问题 I'm trying to follow a car on a map view. This code should animate the car and the map with the same speed, so that the annotation view always appears in the center: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDuration: 1.0]; [UIView setAnimationBeginsFromCurrentState:YES]; [car setCoordinate:coord]; [mapView setCenterCoordinate:coord]; [UIView commitAnimations]; It worked fine in iOS 5. In iOS 6 the map is not

Trying to simulate a route in MapView

偶尔善良 提交于 2019-12-09 04:53:21
问题 I have an array of CLLocation objects I parsed from a file. I'd want to simulate that the user is moving along that route, and I have implemented this: for (CLLocation *loc in simulatedLocs) { [self moveUser:loc]; sleep(1); } This is the method called in the loop: - (void)moveUser:(CLLocation*)newLoc { CLLocationCoordinate2D coords; coords.latitude = newLoc.coordinate.latitude; coords.longitude = newLoc.coordinate.longitude; CustomAnnotation *annotation = [[CustomAnnotation alloc]

Problems with MapView Pin Annotation - Pin loses color when map is zoomed/panned/region changes

杀马特。学长 韩版系。学妹 提交于 2019-12-09 01:31:26
问题 I have a mapview that displays locations of cash points. Annotations are dropped and the callout can be clicked on to go to a page with more detail about that location. There are two categories of cashpoint, free and paid, free cashpoint pins are green and the other red. When the pins drop they are the correct colours. Everything works fine untill i zoom to user location or other areas of the map then when i go back to the pins they have lost their colour formatting and are all the original

Adding MKPolyline Overlay to MKMapView crashes application

て烟熏妆下的殇ゞ 提交于 2019-12-08 23:32:37
问题 My application was working fine on iOS6 but it is crashing on iOS 7 due to bad access when I add overlay to MKMapView.My code is as follows MKPolyline *polyline = [[MKPolyline alloc] init]; polyline = [MKPolyline polylineWithCoordinates:coordinates count:numberOfSteps]; [directionMap addOverlay:polyline]; This is the crash log (lldb) bt * thread #51: tid = 0x1cc5, 0x38755f8c libdispatch.dylib`dispatch_retain$VARIANT$mp + 8, stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0:

MKMapView's user location is wrong on startup or resume

这一生的挚爱 提交于 2019-12-08 17:24:42
问题 When I start my application fresh, or resume after a long time, MKMapView's notion of the userLocation is wrong and shows me in the middle of the sea. I am using the following code: self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate; [mapView setCenterCoordinate:self.mapView.userLocation.location.coordinate zoomLevel:ZOOM_LEVEL animated:YES]; Happens after a lengthy resume of the app or brand new start.... 回答1: That's the expected behavior : the user location isn't

iphone mapview bring first and last annotation to the front

流过昼夜 提交于 2019-12-08 16:45:58
问题 I need some code which can be used outside of the mk* functions. I need to run my custom function to bring the FIRST and LAST markers in an array to the front. (so on top of all the other markers on my screen). I have tried [self.view bringSubviewToFront:[[mapView annotations]objectAtIndex: 0]]; I have used [[mapView annotations]objectAtIndex: 0] in my code and that works, but it crashes when I try to bring this to the front. Am I accessing the wrong layer or something? thanks for any help.

MKPolylineView initWithPolyLine: is deprecated in iOS 7

こ雲淡風輕ζ 提交于 2019-12-08 16:37:37
问题 I am getting the following error: initWithPolyline : is deprecated: first deprecated in iOS 7.0 MKPolylineView *lineView = [[MKPolylineView alloc] initWithPolyline:overlay]; What is the replacement method of instead of this ? 回答1: See the documentation for initWithPolyline: . Read the Deprecation Statement which says to use an MKPolylineRenderer object instead. 回答2: You should use (MKOverlayRenderer *) type delegate instead of (MKOverlayView *) type delegate. And return MKPolylineRenderer