i'm working on Xamarin Maps ( I'm using Forms with a CustomRenderer) on iOS. I'm putting some Pins on my Map, everything works fine until I decide to don't show any Baloon or View on my Pin when i Tap it. I just need to catch the event:
MKMapView.DidSelectAnnotationView
without display any title or subtitle. But the event is called only when i set a title and a subtitle. So, there is a way to put a pin that not display any baloon at Tap and just catch the Tap Event?
I tried to use
anView.CanShowCallout = false;
But nothing happen, the baloon is always showed. I'm using a ClusteringManager and this is the Source code: https://pastebin.com/A6tZAQzc .
Thanks a lot!
I was wrong, i was putting anView.CanShowCallout = false; Only on cluster and not on the single maker. My bad!
Related
Is there some way to detect when the user changes assistant menu or how it is called?
I'm successfully updating the view position when keyboard show/hide or change the keyboard type emoji and etc. But I'm unable to find how to get notification when users hides or extends word suggestion area.
Image showing the action that I'm trying to catch http://i.stack.imgur.com/hY3di.png
What about UIKeyboardWillChangeFrameNotification?
I am using setExtremes to zoom in on detail in a chart, as well as allowing the user to zoom 'x,y' by selecting in the chart. When the user zooms, they get a 'reset zoom' button, however when I call setExtremes, I don't.
Is there a way for me to force the 'reset zoom' button to appear programatically ?
UPDATE:
calling
if( !chart.resetZoomButton ) {
chart.showResetZoom();
}
inside the afterSetExtremes event handler makes the button appear, but clicking it doesn't do anything.
UPDATE:
Rather than calling setExtremes, I've changed to calling
chart.xaxis[0].zoom(minx, maxx);
chart.yaxis[0].zoom(miny, maxy);
chart.redraw();
This has the same affect as the user zoomin in by selecting on the chart.
Just had a look around the HighCharts source code, it looks like this may work out for you:
chart.showResetZoom();
Also, in order for the button to work correctly, you should use axis.zoom instead of setting the extremes:
axis.zoom(newMin,newMax);
Let me know if it works!
You can use showResetZoom, but you have to check if the reset button is already visible, otherwise it won't desapear.
if( !chart.resetZoomButton ) {
chart.showResetZoom();
}
This approach works well:
if (!$('.highcharts-button').length) {
chart.showResetZoom();
}
This is assuming that the only button that might show is the "Reset Zoom" button. If it is already there, don't show another.
If you don't do this check, a new button is added each time you call showResetZoom(). Clicking the visible (most recent) button resets the zoom and removes the button but the older buttons are still visible and do nothing.
If you are using setExtremes you can also set min and max to null to reset:
chart.xAxis[0].setExtremes(null, null)
I am new to Titanium and in the process of making my first iOS app using Titanium but I've hit a wall with a use case.
I am trying to open an annotation on the map by clicking on a particular row on a table view. I haven't had much success with this and was unable to find any help online. Is this impossible to do or am I just doing something wrong? The following is my code:
table.addEventListener('click', function (event) {
Ti.API.info("Index of row that is clicked: "+event.index);
globals.annos[event.index].fireEvent('click');
});
'table' is my TableView with a bunch of rows and global.annos[] is my array of annotations.
My objective is to open the annotation corresponding to the index of the table row that I have clicked.
The above code doesn't achieve anything. I thought firing the 'click' event of the annotation would open the annotation but clearly I was mistaken.
Could someone help me out here? Any help would be much appreciated.
If you are using Android the click event for annotations is not supported. A more cross platform approach is to fire the click event on the MapView itself.
But if you are using iOS, your click event is not set correctly, you have to define what part of the annotation your clicking, according to the documentation :
On iOS, if the user clicks on the pin or annotation, the clicksource is one of: pin, annotation, leftButton, rightButton, leftView, rightView, title, or subtitle. If the user deselects the annotation by clicking elsewhere in the map view, clicksource is null.
And you didnt pass an event object that defines the properties of the synthesized event. Try this inside your table event listener:
var event = {
source : table,
type : 'click',
clicksource : 'pin'
};
globals.annos[event.index].fireEvent('click', event);
SOLVED! Lack of reading the docs more thoroughly!
mapview.selectAnnotation(globals.annos[event.index]);
This opens the corresponding annotation.
I'm having some trouble finding documentation on CLOSING a blackberry map.
My map opens, albeit with some odd marker behavior, but when you close the map it displays a clear screen.
The invoke code is quite simple, as the map request calls a new controller and within the constructor is this:
String document = "<location-document>... etc";
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments( MapsArguments.ARG_LOCATION_DOCUMENT, document));
I tried to add a close line
public boolean onClose() {
UiApplication.getUiApplication().popScreen(this);
return true;
}
but this is not being applied to the map itself, but the page the map opened into. That's logical, I guess.
Maybe I'm going about this all wrong. I don't know of how to open a map another way, or if there is a way to have the close button close the map AND the containing screen.
Any help is appreciated.
I solved this with a simple one line function that fixed this problem.
public void onExposed()
{
UiApplication.getUiApplication().popScreen(this);
}
Adding that to the map controller closes the map application when the user clicks the back button. Simple as that.
Google maps API show a message over the map when user scroll with mouse over the map.
The message advice the user must press control key while scroll with mouse over map.
This is a very nice solution to preserve normal page scroll with the mouse.
How can We do this in open layer 3+ API. Is thus possible? Please a need this behavior.
Thank you in advance.
Here the answers to your questions:
How to detect that the user is doing scroll on the map with the mouse and show an alert that you must press control key?
map.on('wheel', function(){
//write whatyou like and add it in popup window
});
How can you make it so the zoom on the map can only be done by pressing control in addition to scrolling with the mouse?
OpenLayers doesn't have this functionality but you can do it by changing ol.js as you want.
A helpful similar function can be found here
Also, you can do it with only (shift key) or (alt key)
map.on('wheel', function(evt) {
map.on('wheel', function(evt) {
wheelZoom(evt);
});
function wheelZoom(evt) {
if (ol.events.condition.shiftKeyOnly(evt) !== true) {
evt.browserEvent.preventDefault();
}
};