Rotating only the MapView's content

I am trying to rotate a map view in my app according the the user's current route. (I don't like to use the built in compasse because only 3GS uses it and it suffers too much interference from other machines, i.e. your own car.).

the CGAffineTransformMakeRotation method will rotate the Whole Map View, so the Google Logo will not be in the lower right of the screen anymore. Also all Annotation Views will rotate and look weird on the App.

Does anyone knows how to rotate just the content (streets drwaings) of the MkMapView?

Thanks

Answers


Here is how I'm rotating the MapView (see http://stackoverflow.com/questions/1245461/rotate-mapview-using-compass-orientation):

[self.mapView setTransform:CGAffineTransformMakeRotation(-1 * currentHeading.magneticHeading * 3.14159 / 180)];

Then to keep the orientation of the annotation views with the top of the device:

for (MKAnnotation *annotation in self.mapView.annotations) {
     MKAnnotationView *annotationView = [self.mapView viewForAnnotation:annotation]; 
     [annotationView setTransform:CGAffineTransformMakeRotation(currentHeading.magneticHeading * 3.14159 / 180)];
}

If you want the point of rotation of the annotationViews to be say the bottom center, I believe you would set each view's anchorPoint as follows:

  annotationView.layer.anchorPoint = CGPointMake(0.5, 1.0);

I'm still having some issues with the annotationView position changing when I do this though (probably same problem as stackoverflow question: changing-my-calayers-anchorpoint-moves-the-view).


Need Your Help

Layout issues with Winforms present when built in Release mode, not in Debug mode or in the Designer

c# .net winforms visual-studio

I've run across a few layout issues over the years where when making GUIs with Winforms in C# where everything looks totally fine in Debug mode, but then I check it in and test our installed copy, ...

AngularJS creating additional scopes on opening modal dialog multiple times

angularjs modal-dialog angular-ui angularjs-scope

I have a modal with angular-UI bootstrap. Because I've a dozen of different forms I want to show in the modal, I'm using a ng-include directive inside the modal. The src attribute is changing

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.