Draw multiple MKCircle in MapView iphone sdk - iphone

I want to draw multiple MKCircle in mapview but it cause memory problem. I found a solution to reduce memory consommation but it's for MKPolygon in this link MKMapView with multiple overlays memory-issue
My problem is that i want to use it for MKCircle and i don't know how to. Can anyone help me to customize the code to work with MKCircle.
Thank you.

Related

How to resize the custom annotation pin image in MKMapView?

I am using swift 4. I have added MKMapView with some pins but I need to resize the pin image based on the map zooming.
So if anyone knows, how to resize the image based on map zooming?
You can't. Pins always say a constant size as the user zooms the map.
You'll want to look into using a MKOverlay and possibly a custom MKOverlayRenderer subclass. That will allow you to draw content that grows and shrinks as the user zooms in and out.

Performance Issue with Scrollview above MapView

We are developing a map based application which displays large number of annotations above the map using MKMapKit.
We are using a scrollview placed above MapView for differentiating between pinch and drag gestures. We are able to differentiate between pinch and drag but the responsiveness of the Application becomes sluggish while dragged.
We will appreciate any suggestions for improving responsiveness of map while using the scrollview above MapView.
Thanks in advance.
Combining MKMapView and UIScrollView was always a bad idea. Try not to use it. Use UIView with gesture recognizers over the map instead.

MKMapview transform rotate only the map content

I need to transform-rotate a MKMapview based on the course of the CLLocations I get from CoreLocation.
I basically have this already:
mapview.transform = CGAffineTransformMakeRotation(degreesToRadians(course));
However, this is not good since this rotates the entire map, with annotations. Now I can fix the annotations, but the problem is it also rotates the Google logo!
After searching all other posts here on this problem the main answer was this is not possible with the google logo but the thing is, I have seen some Apps (Trapster for example) that actually do this, they rotate the map but the google logo is always in the same place.
So my question is, is there a new function I don't know about that purely rotates the content of the map, or do all these apps rotate the mapview, fix rotations of the annotations and perhaps add their own google image to the view containing the mapview?
Thanks!
Probably you could do by finding the right view with mapView.subviews.
If I do:
for (UIView *aView in mapView.subviews){
NSLog(#"view class: %#", aView.class);
}
I get back:
view class: UILabel
view class: UIView
view class: UIImageView
view class: UILabel
I would guess one of these is the google logo and the map itself...

Use Scrollview like MapView ,with scroll and zoom option

I have some map images and i want that i can scroll that images and i can zoom that images.
Like , MKMapView we can zoom images and the placeMark will remains as it is (it would not zoom).
same thing i want to do without MKMapView with my static images.with the help of scrollview or any other.
is it possible ?,is there any code available?
The class you are looking for is called CATiledLayer. Be warned, it is not trivial. Try reading Matt Gallagher's excellent write up.

Experience with MKMapView Rotation

I have an MKMapView that I am considering rotating in order to more conveniently display a series of Annotations to my users.
As of now I am planning on simply rotating the entire view with a CGAffineTransform, but I wanted to know if anyone had any experience with MKMapView rotation.
Are there any pitfalls or "gotchas" that you came across when adding rotation?
Is there an easier way to rotate a mapview?
If I have an overlay will the convertCoordinate:toPointToView: method still work the same way? I would assume that I'd have to apply the same transform to my overlay for the points to line up, but maybe the method is smarter than that.
If there's anything that you think could help out I'd love to hear it all.
Edit: After much experimentation I believe that I'll be using static maps that I can rotate and overlay myself, however, I would still be interested in any information about MKMapView rotation.
I also plan to use rotated MKMapView in my application. To show annotations unrotated I use the following code:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
...
annotationView.transform = GAffineTransformInvert(mapView.transform);
...
}
It seems to work for me.
Sorry to revive a finished topic, but one more 'gotcha': if you size your map view to be large enough to rotate so that it always covers the entire screen then you'll end up cropping the 'Google' logo from the bottom left. This is explicitly contrary to the licence under which you use MapKit and may be grounds for an app rejection. In practice, adding a static version of the Google logo as a UIImageView on top seems to be considered acceptable by all parties.
That's a fresh sample of MKMapView rotation with iPhone ccelerometer. Hope it'll help.
I started working with MKMapView rotations and have found that:
When you apply a CGAffineTransform to the map view the method convertCoordinate:toPointToView: works the same.
Annotations rotate with the view, including annotation text.
Region that fits still appears to fit to a region on the screen, it doesn't fit to the map view (I made my map view larger than its parent view so it could rotate without showing the view behind).