Wrong map center in iOS
See original GitHub issueHi!
In iOS when I put marker and mapView location, the map does not display centered, but if I move the phone to landscape and rotate again to portrait the map center fine. In Adnroid works fine.
Im using this code:
mapView.clear();
var marker = new mapsModule.Marker();
marker.position = mapsModule.Position.positionFromLatLng(loc.latitude, loc.longitude);
marker.title = "Mi posición";
marker.color = "red";
mapView.addMarker(marker);
mapView.latitude = loc.latitude;
mapView.longitude = loc.longitude;
mapView.settings.zoomGesturesEnabled = false;
mapView.zoom = 15;
And this is my view:
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:maps="nativescript-google-maps-sdk" navigatingTo="onNavigatingTo" loaded="onPageLoaded" class="page" actionBarHidden="true">
<StackLayout class="" verticalAlignment="top" height="100%">
<StackLayout class="p-10 action-bar" orientation="horizontal" verticalAlignment="top" height="75">
<StackLayout>
<Image src="res://autocorp_notext" height="30" horizontalAlignment="left"></Image>
<Label text="Tu asistente de movilidad" class="subtitulo-bar" textAlignment="left" />
</StackLayout>
<StackLayout style="width: 100%; padding: 0; margin: 0" verticalAlignment="middle" horizontalAlignment="right">
<Button text="Asistencia" tap="onHelp" horizontalAlignment="right" class="btn btn-help" textWrap="true"/>
</StackLayout>
</StackLayout>
<GridLayout rows="*" height="100%">
<StackLayout row="0" height="100%">
<!-- <maps:mapView latitude="-34.6037345" longitude="-58.3837591" zoom="15" mapAnimationsEnabled="true" mapReady="onMapReady" markerSelect="onMarkerSelect" markerBeginDragging="onMarkerBeginDragging" markerEndDragging="onMarkerEndDragging" markerDrag="onMarkerDrag" cameraChanged="onCameraChanged" cameraMove="onCameraMove" /> -->
<maps:mapView width="100%" height="100%" latitude="-34.6037345" longitude="-58.3837591" zoom="15" mapReady="onMapReady" mapAnimationsEnabled="true" zoomGesturesEnabled="false" myLocationButtonEnabled="false" compassEnabled="false" />
<!-- <Image src="res://mapa_autocorp" stretch="aspectFill"></Image> -->
</StackLayout>
<StackLayout row="0" id="stkCards" backgroundColor="transparent" height="100%" style="padding: 0;margin: 0">
<StackLayout height="100%" orientation="vertical" backgroundColor="transparent" style="padding-left: 30;padding-right: 30;padding-bottom: 0;padding-top: 30;">
<ListView items="{{ noticias }}" height="100%" backgroundColor="transparent" itemTap="onItemTap" loaded="{{ onListViewLoaded }}" id="listView" separatorColor="transparent">
<ListView.itemTemplate>
<StackLayout>
<StackLayout class="card" orientation="horizontal" width="auto" marginTop="{{ TopMargin }}">
<StackLayout width="18%" style="margin-right: 10">
<Image src="res://icono_texto"></Image>
</StackLayout>
<StackLayout width="82%">
<Label text="{{ Date }}" horizontalAlignment="right" class="card-date" />
<Label text="{{ Title }}" horizontalAlignment="left" class="card-titulo" />
<Label text="{{ Text }}" textWrap="true" horizontalAlignment="left" class="card-texto" />
<TextView id="{{ 'txtTexto' + SerNr }}" visibility="{{ !Enviada && DataType == 'A' ? 'visible' : 'collapsed' }}" text="" hint="" autocorrect="false" class="input input-border input-card"></TextView>
<TextField id="{{ 'txtNum' + SerNr }}" visibility="{{ !Enviada && DataType == 'N' ? 'visible' : 'collapsed' }}" text="" hint="" autocorrect="false" class="input input-border input-card" keyboardType="number"></TextField>
<DatePicker id="{{ 'dpk' + SerNr }}" visibility="{{ !Enviada && DataType == 'D' ? 'visible' : 'collapsed' }}"></DatePicker>
<StackLayout orientation="horizontal" horizontalAlignment="right">
<Label text="Enviar" visibility="{{ !Enviada && DataType != '' ? 'visible' : 'collapsed' }}" horizontalAlignment="right" SerNr="{{ SerNr }}" DataType="{{ DataType }}" class="card-enviar" onTap="onTapEnviar" />
<Label text="Descartar" visibility="{{ (Enviada || Mandatory == 0) || DataType == '' ? 'visible' : 'collapsed' }}" horizontalAlignment="right" SerNr="{{ SerNr }}" class="card-descartar" onTap="onTapDescartar" />
</StackLayout>
</StackLayout>
</StackLayout>
</StackLayout>
</ListView.itemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</GridLayout>
</StackLayout>
</Page>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Wrong map center in iOS using nativescript-google-maps-sdk
In iOS when I put marker and mapView location, the map does not display centered, but if I move the phone to landscape...
Read more >Apple maps gps pointer arrow wrong direct…
Hello! my apple maps pointer arrow is tilted slightly to the right which is inaccurate, i tried to turn location services on and...
Read more >Fix a missing address or wrong pin location - Google Maps Help
On your iPhone or iPad, open the Google Maps app Maps . Search for an address. Then, tap Suggest an edit and then...
Read more >Configure a map | Maps SDK for iOS - Google Developers
This topic describes how to configure a map that was added to an iOS app using the ... The camera's target will reflect...
Read more >Migrate to v10 | Maps SDK | iOS - Mapbox docs
You can use the associated error message to notify the user that map data is unavailable. */ mapView.mapboxMap.onNext(.mapLoadingError) { (event) in guard ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay folks, here the solution : https://stackoverflow.com/a/54445615/3565182
Simply the center moves up to the left