Map Padding with the Google Maps SDK for iOS
Map padding in the Google Maps SDK for iOS (http://goo.gl/8n3lV) allows you to change the visible region of your map, so that your controls, logo, and copyright notices are all aligned with your view. In this video, Mano Marks explores the benefits of map padding and how to implement it in the SDK.
Closed Caption:
Hi, I'm Mano Marks.
I'm a developer advocate
on the Google Maps team.
In this video, I'm
going to show you
how to use map
padding to control
the visible region of your map
in the Google Maps SDK for iOS.
First, let's take a look
at what padding does.
I've modified the
map padding demo
in the demos project
that comes with the SDK
that you can download from
the documentation page.
First, I disable map
padding and run the demo.
When I toggle the overlay, it
creates a view and moves it up.
As you can see, it blocks
a portion of the map,
including the controls and
the Google logo and copyright
notices.
This reduces the
functionality of the map
and is not in compliance
with the Maps API terms,
which do require that
the logo and copyright
notices be visible.
But if I enable map
padding, I can correctly
set the visible
region of the map
so that text and control
positioning, map gestures,
and camera movements
all behave as if they
are placed in the padded map,
even though the map takes up
the entire container.
The map will continue to
fill the entire container,
but text and control
positions, map gesture,
and camera movements
will behave as if they've
been placed on the padded space.
However, as you can
see through this view,
it retains its
original overall size.
The code is really simple.
All you need is a
UIEdgeInsets object.
You set it using the GMS
map view padding property.
For more information
on map padding,
check out the
documentation at this link.
And if you want more
information on getting started
with the Google Maps SDK for
iOS, check out this playlist.
Video Length: 02:16
Uploaded By: Google Developers
View Count: 11,359