Google Maps iOS Disable Rotation & Tilt - ios

Trying to disable rotation and tilt on my map view but keep zoom and scrolling.. I have tried the following code but the zoom enabled and scroll enabled cause a error as it says the property is not part of the map view.
self.mapView.userInteractionEnabled = NO;
self.mapView.zoomEnabled = YES;
self.mapView.scrollEnabled = YES;
Thanks,
Curtis

I had a few replies to this but managed to solve it myself. There is such a thing called GMSUI Settings which you need to call using the following code..
self.mapView.settings.rotateGestures = NO;
self.mapView.settings.tiltGestures = NO;
Hope this solved things for others

Xcode 14.2
Swift 5.7
whatever your map-view name is would be what you start with. In my case I named it mapView.
mapView.settings.rotateGestures = false
mapView.settings.tiltGestures = false

Unless you specifically need google maps over Apple maps I would recommend using MKMapView
https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html
The following properties are defined
zoomEnabled
scrollEnabled
pitchEnabled
rotateEnabled
pitch would be the tilt you were looking for.

Related

How to hide circular compass icon on MKMapview in iOS

I want to hide the circular compass icon on MKMapview which appears when a user rotates the map. I have attached a screen shot for reference. I don't want to display the circular compass icon but I do want to allow rotation on the map.
Starting in iOS 9 you can finally hide the compass in MKMapView.
mapView.showsCompass = NO;
If you're not rotating the map programatically and it hasn't already been rotated, disable rotation entirely, using
mapView.rotateEnabled = NO;
The compass only shows up when the map is rotated, so by doing this you ensure that the compass is never triggered.
The current iOS maps does not have the option to turn off the compass.
MapKit Class in the apple documentation also does not carry any information about a compass setting as either a property or creation only setting.
Without restriction on rotation you need to try with the solution given at following url:
http://jdkuzma.tumblr.com/post/79294999487/xcode-mapview-offsetting-the-compass-and-legal
You can either try it by setting its layout margin:
By moving a little bit lower:
[self.mapView setLayoutMargins:UIEdgeInsetsMake(20, 0, 20, 0)];
or moving it up a little bit higher:
[self.mapView setLayoutMargins:UIEdgeInsetsMake(-50, 0, -50, 0)];
Hope this might get you what you need.

MapBox iOS SDK - First steps

I'm having problems taking the first few steps with MapBox iOS SDK (1.4.1).
I've started with the suggested code over here: https://www.mapbox.com/mapbox-ios-sdk/examples/
- (void)viewDidLoad {
[super viewDidLoad];
self.mapBoxView.tileSource = [[RMMapboxSource alloc] initWithMapID:#"my_map_id" enablingDataOnMapView:_mapBoxView];
self.mapBoxView.userTrackingMode = RMUserTrackingModeNone;
CLLocationCoordinate2D centerLocation;
centerLocation.latitude = NRMapStartLatitude;
centerLocation.longitude = NRMapStartLongitude;
[self.mapBoxView setCenterCoordinate:centerLocation];
[self.mapBoxView setZoom:7 animated:YES];
}
No matter what I do the map starts at a location in Washington D.C. but I've set the center coordinate to be somewhere in Europe.
The same with the zoom. No matter what value I try it has no effect on the map.
There's something with the NSLog output that confuses me. At startup it says:
Using watermarked example map ID examples.map-z2effxa8. Please go to
https://mapbox.com and create your own map style.
I was assuming that this is something that I already did by registering for a free account there and starting with my first project.
Added the tilesource 'My First Map' to the container
Origin is calculated at: 120.786199, -85.000000 Map initialised. tileSource:RMMapboxSource:
Mapbox iOS Example, zooms 0-19, no interactivity, minZoom:2.000000, maxZoom:18.000000,
zoom:18.000000 at {-77.032458,38.913175}
Apparently the sample project in the iOS SDK is loaded and ignoring everything else I try to configure.
So, how do I configure the map so I can interact with the API. What am I missing?
Any kind of help is highly appreciated. Thank you!
OK, whoever is struggling with that. The trick is to set the zoom BEFORE you set the center coordinate..
..for whatever reason.

MKMapView in iOS 7

I have a problem with MKMapView in iOS7, I have been using it with iOS5 and worked flawless (at least what Im trying to do).
Well my problem is that .userTrackingMode won't work in iOS7. Been searching for an answer but haven't found any.
I want to show user location, it work fine with .showsUserLocation. But when I want to track it its like it just ignores it. Anyone have a fix?
This is how I wrote it in iOS 5:
mMapView.showsUserLocation = YES;
mMapView.userTrackingMode = YES;
mMapView.userInteractionEnabled = NO;
And what I know there wasn't any changes with the code in the upgrade.
EDIT:
Don't know why but I used
[self.mapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
inside a method that change a label every time that the location change. Then its working.
Don't know why it's not working when I declare it in viewDidLoad... ?
Welp, in Apple's documentation for MKMapView, ".userTrackingMode" is not a BOOL but instead it's an "enum" (Integer) property:
typedef enum : NSInteger {
MKUserTrackingModeNone = 0,
MKUserTrackingModeFollow,
MKUserTrackingModeFollowWithHeading,
} MKUserTrackingMode;
Maybe you're setting it wrongly could be part of the problem?
Also, the best way to set it is via this API:
- (void)setUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated (I've linked the Apple documentation for you). There's a useful "animated" argument there.

How to set MKMapView view angle and turn off 3D building?

I am currently working on a navigation app. Is there a way to set view angle in MapKit? I know Google Map iOS SDK has it as one of parameter in viewing camera that you could set, but I wasn't able to find it in MapKit.
Also is there a bool value to turn off 3D building? They are kind of annoying for a navigation app.
Thanks in advance!
Add in viewDidLoad or viewWillAppear:
self.mapView.pitchEnabled = YES;
self.mapView.pitchEnabled = NO;
self.mapView.showsBuildings = false
(swift code) Turns off buildings.
Swift 4
mapView.settings.tiltGestures = false
Use pitch to provide viewing angle. For example, mapview.pitch or mapview.camera.pitch depending on whether you are using a camera or not. Also, set showsbuildng to NO.

Disable PSPDFKit thumbnail

I'm trying to disable the thumbnail see image that comes with PSPDFKit, I'm not sure exactly what its called so I'm having a really hardtime finding it in the code. Anyone that has used this library before have any idea where this thumbnail is coming from, what its called, or has anything that might help! Thanks.
To Disable the ScrobbleBar(Thumbnail Preview) and Position Overlay(Page no:) of the PDF in PSPDFKit
you have to do the following
PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:yourMagazine];
pdfController.scrobbleBarEnabled = NO; // Disable the Bottom Scrobble Bar
pdfController.pageLabelEnabled = NO; // Disables the bottom document site position overlay.

Resources