我已经提到了下面提到的所有内容,但没有任何帮助。我的要求是如果我们加倍标签或放大或缩小,地图和输入的图像不应该像优步,Carrem一样移动。我是IOS的新手。我已经放置了代码,任何人都可以帮助我,
Zoom in the center of the screen - Google Maps iOS SDK Swift Google Maps SDK iOS - prevent map from changing location on zoom How to setCenter mapview with location in google maps sdk for iOS
#import "ViewController.h"
#import <GoogleMaps/GoogleMaps.h>
@interface ViewController ()<UIGestureRecognizerDelegate,CLLocationManagerDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//To hide the default gestures
self.mapView.settings.allowScrollGesturesDuringRotateOrZoom=NO;
//self.mapView.settings.zoomGestures=NO;
//self.mapView.settings.rotateGestures=NO;
//After loading page camera will point this.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:24.840216
longitude:46.676199
zoom:14];
[self.mapView animateToCameraPosition:camera];
self.mapView.settings.myLocationButton=TRUE;
//Make the image as center of the map
UIImageView *pin =[[UIImageView alloc]init];
pin.frame=CGRectMake(0, 0, 40, 40 );
pin.center = self.mapView.center;
pin.image = [UIImage imageNamed:@"location.png"];
[self.view addSubview:pin];
[self.view bringSubviewToFront:pin];
UIPanGestureRecognizer *doubleTab = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)];
doubleTab.delegate=self;
//doubleTab.numberOfTapsRequired=2;
[self.mapView addGestureRecognizer:doubleTab];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void) didPan:(UIPanGestureRecognizer*) gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateEnded)
{
NSLog(@"YES");
self.mapView.settings.scrollGestures = YES;
}
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
if (gestureRecognizer.numberOfTouches > 1)
{
NSLog(@"gestureRecognizer:NO");
self.mapView.settings.scrollGestures = NO;
}
else
{
NSLog(@"gestureRecognizer:YES");
self.mapView.settings.scrollGestures = YES;
}
return true;
}
@end
答案 0 :(得分:0)
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285
longitude:103.848
zoom:12];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView.settings.scrollGestures = NO;
mapView.settings.zoomGestures = NO;
self.view = mapView;