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)]; 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]); },