Question

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?

Was it helpful?

Solution 2

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

OTHER TIPS

add this if you need touches enable in uitextfield

 for (id gestureRecognizer in mapView_.gestureRecognizers)
    {
        NSLog(@"mapview recognizer %@",gestureRecognizer);
        if (![gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]])
        {
            [mapView_ removeGestureRecognizer:gestureRecognizer];
        }
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top