Skip to content

Instantly share code, notes, and snippets.

@mollietaylor
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mollietaylor/883c6cf2836f25a82f07 to your computer and use it in GitHub Desktop.
Save mollietaylor/883c6cf2836f25a82f07 to your computer and use it in GitHub Desktop.
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <UIKit/UIKit.h>
#import "Mapbox.h"
//
// ViewController.swift
// Mapbox Marker Image
//
// Created by Mollie on 1/29/15.
//
import UIKit
class ViewController: UIViewController, RMMapViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
RMConfiguration().accessToken = "your-api-token"
var mapFrame = CGRectMake(0, 20, view.bounds.width, view.bounds.height)
var mapTiles = RMMapboxSource(mapID: "your-map-id")
var mapView = RMMapView(frame: mapFrame, andTilesource: mapTiles)
mapView.delegate = self
mapView.zoom = 10
mapView.centerCoordinate = CLLocationCoordinate2DMake(33.75, -84.39)
var location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(33.78,-84.41)
var annotation = RMAnnotation(mapView: mapView, coordinate: location, andTitle: "Proximity Viz LLC")
annotation.subtitle = "Maps & Apps"
annotation.userInfo = "company"
mapView.addAnnotation(annotation)
view.addSubview(mapView)
}
func mapView(mapView: RMMapView!, layerForAnnotation annotation: RMAnnotation!) -> RMMapLayer! {
var marker: RMMarker = RMMarker(UIImage: UIImage(named: "proximity"))
marker.canShowCallout = true
return marker
// var parkMarker: RMMarker = RMMarker(UIImage: UIImage(named: "park"))
// parkMarker.canShowCallout = true
//
// if(annotation.userInfo as NSString == "park"){
// return parkMarker
// } else {
// return marker
// }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment