Community

Topic: Xamarin component

Geo Augmented Markers (SOLVED)

Nun Dabold
Thursday, October 19, 2017

I'm using IOS/Xamarin and your GeoTutorial. On the labels for the POI markers in the camera view is it possible to insert a newline so I can have 2 lines of text on the label? I tried \n but that didn't seem to work. Thanks

user profile image
Support Team  (expert)
Monday, October 23, 2017

Hi,
the default marker view used in GeoLocalization is composed by an image and a label with one number of lines.
If you would use a more complex view for geo/map markers, you should use PKTGeoMainController with
this custom initializer:

IntPtr Constructor(PKTMarkerViewAdapter geoViewAdapter, PKTMarkerViewAdapter mapViewAdapter);
and implement two PKTMarkerViewAdapter subclass that returns custom views (selected, not selected)
either for geo and map views.
If you want to see an example please follow this link to the tutorial.
Best regards,

Nun Dabold
Tuesday, October 24, 2017

Thank you. I've visited that page, but it doesn't explain how to change the image or label unless I'm missing something. It ends with 'Here, we use MarkerViewAdapter class, that provide two virtual methods where you could customize normal and selected marker view. Check Tutorial how to use this class.' - where is the IOS/Xamarin tutorial that explains how to customize the normal and selected marker/labels? Ideally, I would like to change the label to make it easier to read.

user profile image
Support Team  (expert)
Tuesday, October 24, 2017

Hi,
in order to customize the geo/map view markers, you should implements two PKTMarkerViewAdapter classes, one for geolocalization marker views and one for the map markers views.
This should be implemented as follow:

class GeoViewMarkerAdapter:PKTMarkerViewAdapter {

public GeoViewMarkerAdapter(CGSize size):base(size) {}
public override UIView GetView(PKTGeoElement geoElement) {
//here return new geo marker view
}
public override UIView GetSelectedView(PKTGeoElement geoElement) {
//here return new geo marker selected view
}
}
class MapViewMarkerAdapter:PKTMarkerViewAdapter {
public MapViewMarkerAdapter(CGSize size):base(size) {}
public override UIView GetView(PKTGeoElement geoElement) {
//here return new map marker view
}
public override UIView GetSelectedView(PKTGeoElement geoElement) {
//here return new selected map marker view
}
}

Then, you should create PKTGeoMainController as follow:
PKTGeoMainController geoCtrl=new PKTGeoMainController(new GeoViewMarkerAdapter(new CGSize(30,45)), new MapViewMarkerAdapter(new CGSize(30,45)));
In this way, you could further customize geo and map marker view, assign one view for each marker or using
the same custom view for each geoElement.
Kind Regards

Nun Dabold
Monday, November 20, 2017

Thanks, it's almost working.
I can override UIView GetView and return an UIImageView with my own image, but if I setup my Points of Interest using:
poiNames.Add("Eiffel Tower"...etc.
How do I display the POI name (ie. Eiffel Tower) in this new view I have created? I assume I add a UILabel or UITextField but I cannot make the new view display any text.

user profile image
Support Team  (expert)
Monday, November 20, 2017

Hi,
the callback methods getView and getSelectedView of PKTMarkerViewAdapter class receive as input a PKTGeoElement object, that is the model associated to the Point of Interest has been selected by user.
Inside this two callbacks, you could build each custom view you prefer, (via .xib or programmatically) and fill elements with data coming from PKTGeoElement, using its name id or geoLocation instance variables members.

Sign in to add a comment