Search code examples
iosuitextfieldgmsmapview

GMSMapView not invoking keyboard


I'm trying to invoke keyboard for typing on a UITextField. This is how I add the 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];

}

Is it because of the mapview properties? Is there an alternative for this?


Solution

  •  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_];