iOS Google Maps textField not Responding

后端 未结 4 615
借酒劲吻你
借酒劲吻你 2020-12-10 19:53
#import \"MyLocationViewController.h\"
#import 


@interface MyLocationViewController ()

@end

@implementation MyLocationViewControll         


        
4条回答
  •  执念已碎
    2020-12-10 20:27

    Add Your UITextfield or UISearchbar in to subview of Mapview_

    UISearchBar *search;
    search = [[UISearchBar alloc] init];
        [search setTintColor:[UIColor colorWithRed:233.0/255.0
                                             green:233.0/255.0
                                              blue:233.0/255.0
                                             alpha:1.0]];
        search.frame = CGRectMake(50,20,self.view.frame.size.width-70,32);
        search.delegate = self;
        search.placeholder = @"MapView";
    [mapView_ addSubview:search];
    

    Add Following method to your .m file

    // Remove the GMSBlockingGestureRecognizer of the GMSMapView.
    + (void)removeGMSBlockingGestureRecognizerFromMapView:(GMSMapView *)mapView
    {
        for (id gestureRecognizer in mapView.gestureRecognizers)
        {
            NSLog(@"mapview recognizer %@",gestureRecognizer);
            if (![gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]])
            {
                [mapView removeGestureRecognizer:gestureRecognizer];
            }
        }
    }
    

    Call This Method from your view will appear

    - (void)viewWillAppear:(BOOL)animated {
        [ViewController removeGMSBlockingGestureRecognizerFromMapView:mapView_];
    
    }
    

    Now it will work , i got tested with this code only.

提交回复
热议问题