Hi.
I'm Mano Marks with the Maps Developer Relations team here
at Google in Mountain View.
I am going to talk to you today about the Google Maps
SDK for iOS and specifically about some new marker
management features that we added to the
SDK in version 1.2.
So in version 1.1, when you had a map, when you wanted to
add a marker you added the marker from the map object.
Let's take a look at what that code actually looks like.
You can see here in older versions, 1.1 and before, you
would create a GMSMarkerOptions object and
create a CLLocationCoordinate object.
And then with MapView, you would call
addMarkerWithOptions and give it the options object.
We don't do that anymore.
The reason that we don't do that anymore is because we
wanted to give you a lot more control over marker objects.
Let's take a look at what code looks like today.
So you can see here, I've got two arrays, two immutable
arrays, and what I'm doing is I'm just adding random markers
into those arrays.
And you'll see what I'm doing is I'm creating the marker
object, GMSMarker object, separate from the map.
What this allows you to do is then assign the marker to any
map object that you want to use in your application.
It also allows you to do interesting things, like
create your own marker management tools and
techniques, you can create your own quadtrees or
clustering algorithms, or anything that you want, which
wasn't previously easy to do with the Google Maps SDK.
So you see here, each marker that--
I'm adding 10 markers--
and every other marker I'm adding making it green.
And you'll see here, we also added to this add marker.
You could add colors to your marker using the marker image
with color.
And so what that looks like here is you see I have red and
green markers being added to the map.
And this allows me to do things like walk through one
or the other of the arrays and just turn on or off each
marker by simply assigning the map to nil.
So when you want to assign a marker to a map, you just say
marker.map equals this particular map view.
Or you assign it to nil.
The marker objects still exists, it's still something
that's around for you to use, and you can assign it back to
the map when you want to.
So you'll see here, that allows us to
do things like this.
I've got this simple one here.
Here, I can turn off all the markers by simply assigning
them map.nil.
I can turn on all the red or I could turn on all the green,
because they're in separate arrays.
So pretty simple but powerful change that gives you a lot
more control over how you manage markers in the iOS SDK.
So that's it.
That's your shortcut for today.
Thanks for tuning in, and we'll see you next week.