0

我正在尝试调用键盘在 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];

}

是因为地图视图属性吗?有替代方案吗?

4

2 回答 2

2

如果您需要在 uitextfield 中启用触摸功能,请添加此项

 for (id gestureRecognizer in mapView_.gestureRecognizers)
    {
        NSLog(@"mapview recognizer %@",gestureRecognizer);
        if (![gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]])
        {
            [mapView_ removeGestureRecognizer:gestureRecognizer];
        }
    }
于 2014-11-10T04:34:02.520 回答
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_];
于 2014-05-02T09:59:18.457 回答