Create a gist now

Instantly share code, notes, and snippets.

//
// 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