Show Multiple location on MapView - NEWBIE - iphone

I would like to add more locations on MapView something similar to this image. In this image there are only 2 pin points, but i need to have more than 10 locations to add in the map. Is this possible ? and is there any tutorial/sample code where i could start on this ?

You need to implement the annotation protocol, which simply requires you to include a couple of fields in an object so the map view knows what to annotate the 'pin' with.
You can then add multiple pins to the map view programatically.
I found this blog post useful when I was doing this.
http://mayurbirari.wordpress.com/2011/02/07/how-to-access-mkmapkit-in-iphone/

It's called MKPinAnnotationView and you can have as many as you want on map.
You need to implement protocol for it and it has pin as default image property.

Related

Create custom map with annotations in Swift

Is there a way with Swift to realise something similar like this http://www.dayzdb.com/map Can I load an UIImage, that I can pinch and zoom and place annotation or images on specific locations. Or is there a way with the MapKit?
Thanks in advance

Custom Map View

Here is the scenario...
I have a image of a map in jpeg format... I want to add it to my iPhone application and mark the coordinates in certain places (just like annotation in map kit ) and also when i move from one place to another place the current location should change and the new location should be marked in the image.
Is that possible ? How to achieve this instead of using the mkmapview ?
I found this tutorial how to add custom google maps, maybe you could use your image (.jpeg) as a overlay.
stiern.com/tutorials/adding-custom-google-maps-to-your-website
Sounds like you want to use an MKOverlay.
Essentially it boils down to looking at the TileMap sample code from WWDC 2010. It'll still load the Google Map in the background and your map over the top

What is the difference between MKOverlay and MKAnnotation?

I am new to MKMapView. I implemented a mapView which is looking good. But i was planning to add points or custom image as point in MapView. I can implement it with the help of MKAnnotation, but when i read MKOverlay it was mentioned that Overlays are also annotations. So whats the difference between these two??
Thanks in advance,
aby
In a nutshell, MKAnnotation is based on a point (x,y). MKOverlay is based on an area, bounded by a rectangle.
An MKAnnotation is simply a point on the map, often represented with a red pin icon (you'll see these if you search for a location in Apple's Maps app on iOS), whereas an MKOverlay is another layer over the map to display extra information. A good example of this could be the traffic overlay displayed on the map in US regions to indicate the current level of traffic.
You'd want to use an MKAnnotation in situations where you need to show the user a specific point on a map, but if you want to display more information to them over a larger area, go with an MKOverlay.
Apple uses an MKOverlay to display shipping routes for boats in their WWDC video on the topic (Session 127 – Customizing Maps with Overlays). That would be a good place to learn the full difference between the two, and how to use overlays correctly.

iPhone - Add annotation to My own Map

I have an image plan of stores of exhibitors hall. So I need to add annotation to each store in the plan, which is a jpg file.
iPhone MapKit looks like supports only world map. Are there any way I can add my own picture and add annotation to it like google map annotation.
Thanks
I don't think you can do that.
What you can do is using a UIScrollView to scroll and zoom in/out your jpg plan and use subviews to simulate annotations. That's what I would do.
MapKit does not support custom tiles, so your only option is to implement your own map using UIScrollView (and potentially CATiledLayer if the map is large / has many zoom levels).

iPhone - MapKit - Searching locations and moving annotations

I want to make an app that partially mimics some of the behavior the standard map application has. This has proven difficult. First of all, I don't understand how you make annotations movable. How exactly do you do this?
Second: how do you search for locations?
Moving annotations
I'm assuming you're after the behavior of Maps.app where you tap and hold on to a pin to move it around freely. As far as I know, there is no built in way of moving annotations around. Since annotations are subclasses of UIView though, you can draw them where and how you'd like. You could for example detect a tap-n-hold on the annotation, and when "unlocked" change the centerOffset value of your annotation to move it around with the touch. When the user lets go of the the view, you can note the position on the screen, and use the MKMapView method convertPoint:toCoordinateFromView: to get the coordinates that the pin was released.
Search for location
What you are looking for is called Forward Geocoding. Unfortunately, MapKit only comes with Reverse Geocoding (the process of converting GPS coordinates to country/city/street/etc). There is, however, several alternatives. Here's a few ways:
http://code.google.com/apis/maps/documentation/geocoding/index.html
http://cloudmade.com/products/iphone-sdk
http://www.geonames.org/export/web-services.html
http://developer.yahoo.com/maps/rest/V1/geocode.html
Note that many geocoding APIs are licensed under Creative Commons, or similar licenses.
You should be able to get drag-and-drop annotations going with the help of this blog post. I used it to do the same thing, and it was pretty simple to get going.
MapKit annotation drag and drop with callout info update