class ProMotion::MapScreenAnnotation
Attributes
params[R]
Public Class Methods
new(params = {})
click to toggle source
Creates the new annotation object
# File lib/ProMotion/map/map_screen_annotation.rb, line 6 def initialize(params = {}) @params = params set_defaults if @params[:coordinate] @params[:latitude] = @params[:coordinate].latitude @params[:longitude] = @params[:coordinate].longitude @coordinate = @params[:coordinate] elsif @params[:latitude] && @params[:longitude] @coordinate = CLLocationCoordinate2D.new(@params[:latitude], @params[:longitude]) else PM.logger.error("You are required to specify :latitude and :longitude or :coordinate for annotations.") nil end end
Public Instance Methods
annotation_params()
click to toggle source
Deprecated
# File lib/ProMotion/map/map_screen_annotation.rb, line 77 def annotation_params PM.logger.warn("annotation.annotation_params is deprecated and will be removed soon. Please use annotation.params instead.") @params end
cllocation()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 55 def cllocation CLLocation.alloc.initWithLatitude(@params[:latitude], longitude:@params[:longitude]) end
coordinate()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 43 def coordinate @coordinate end
left_accessory()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 47 def left_accessory @params[:left_accessory] end
method_missing(meth, *args)
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 67 def method_missing(meth, *args) if @params[meth.to_sym] @params[meth.to_sym] else PM.logger.warn "The annotation parameter \"#{meth}\" does not exist on this pin." nil end end
right_accessory()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 51 def right_accessory @params[:right_accessory] end
setCoordinate(new_coordinate)
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 59 def setCoordinate(new_coordinate); if new_coordinate.is_a? Hash @coordinate = CLLocationCoordinate2D.new(new_coordinate[:latitude], new_coordinate[:longitude]) else @coordinate = new_coordinate end end
set_defaults()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 22 def set_defaults @params = { title: "Title", pin_color: :red, identifier: "Annotation-#{@params[:pin_color]}-#{@params[:image]}", show_callout: true, animates_drop: false, image: nil, left_accessory: nil, right_accessory: nil, }.merge(@params) end
subtitle()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 39 def subtitle @params[:subtitle] ||= nil end
title()
click to toggle source
# File lib/ProMotion/map/map_screen_annotation.rb, line 35 def title @params[:title] end