GMSMapView不调用键盘

时间:2014-05-02 09:39:56

标签: ios uitextfield gmsmapview

我试图调用键盘在UITextField上输入。这就是我添加UITextField的方式:

@implementation SOViewController{
   GMSMapView *mapView_; 
}


- (void)viewDidLoad
{

 self.view = mapView_;
 UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, 190, 200)];
 [tf setText:@"test"];

 [self.view addSubview:tf];

}

是否因为mapview属性?   有替代方案吗?

2 个答案:

答案 0 :(得分:2)

如果您需要在uitextfield中启用触摸

,请添加此项
 for (id gestureRecognizer in mapView_.gestureRecognizers)
    {
        NSLog(@"mapview recognizer %@",gestureRecognizer);
        if (![gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]])
        {
            [mapView_ removeGestureRecognizer:gestureRecognizer];
        }
    }

答案 1 :(得分:1)

 locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude
                                                        longitude:locationManager.location.coordinate.longitude
                                                             zoom:16];

mapView_ = [GMSMapView mapWithFrame:CGRectMake(0, 44, self.view.bounds.size.width, self.view.bounds.size.height-44) camera:camera];
mapView_.myLocationEnabled = YES;
[self.view addSubview:mapView_];