From 19ed71284b39abe24cefcbc6970376757ce7d85c Mon Sep 17 00:00:00 2001 From: Ronald Klip Date: Fri, 5 Jul 2013 16:45:22 +0200 Subject: [PATCH 1/2] Enabled javascript callback. --- src/ios/MapKit.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ios/MapKit.m b/src/ios/MapKit.m index 9160c20..454d002 100644 --- a/src/ios/MapKit.m +++ b/src/ios/MapKit.m @@ -44,6 +44,10 @@ - (void)createViewWithOptions:(NSDictionary *)options { if(atBottom) { y += self.webView.bounds.size.height - height; } + + if ([options objectForKey:@"buttonCallback"]) { + self.buttonCallback=[[options objectForKey:@"buttonCallback"] description]; + } self.childView = [[UIView alloc] initWithFrame:CGRectMake(x,y,width,height)]; self.mapView = [[MKMapView alloc] initWithFrame:CGRectMake(self.childView.bounds.origin.x, self.childView.bounds.origin.x, self.childView.bounds.size.width, self.childView.bounds.size.height)]; From 5ee9290883cdc7860715d3e5de0db84c1ed81dc2 Mon Sep 17 00:00:00 2001 From: Ronald Klip Date: Fri, 5 Jul 2013 17:00:03 +0200 Subject: [PATCH 2/2] Added dummy callback method. Please note that you need to add an index property to each of your pin objects for this to make any sense. --- www/MapKit.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/www/MapKit.js b/www/MapKit.js index a4b0107..f15a84b 100644 --- a/www/MapKit.js +++ b/www/MapKit.js @@ -5,6 +5,7 @@ var MapKit = function() { this.options = { + buttonCallback: 'window.mapKit.onMapCallback', height: 460, diameter: 1000, atBottom: true, @@ -36,6 +37,10 @@ MapKit.prototype = { + onMapCallback: function(pindex) { + // alert('Index of selected pin: ' + pindex); + }, + showMap: function(success, error) { cordovaRef.exec(success, error, 'MapKit', 'showMap', [this.options]); },