#In Development.
An Objective-C wrapper around the Google Static Maps API v2. Fully documented.
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects, which automates and simplifies the process of using 3rd-party libraries like DTGoogleStaticMaps in your projects.
Add the following to your Podfile:
pod 'DTGoogleStaticMaps', '~> 0.0'Here is a simple example of how to download a static map image:
#import <DTGoogleStaticMaps/DTGoogleStaticMaps.h>DTLocation *location = [[DTLocation alloc] initWithAddress:@"Brooklyn Bridge,New York,NY"];
DTStaticMapRequest *request = [[DTStaticMapRequest alloc] initWithApiKey:@"API_KEY" center:location zoom:12 size:CGSizeMake(200, 200)];
[DTStaticMapDownloader downloadMapWithRequest:request completion:^(UIImage *mapImage, NSError *error) {
if (error) {
//we received an error
} else if (mapImage) {
//use image
}
}];You can use DTStaticMapDownloader to download the image, or — use the url method in the DTStaticMapRequest class to get the request's URL object. You can then download the image with a preferred library. For Example, using SDWebImage:
[imageView sd_setImageWithURL:[request URL]];DTGoogleStaticMaps is released under the MIT license. See LICENSE for details.