简体   繁体   中英

Not able to enter text in the textfield

I am working on Google maps where I enter the text in text field and based on the text enter find the location but unfortunately I am not able to enter the text in the text field.I know it might be very small issue but not able to figure it out.I also tried to find it on net.

Can any one help me?

- (void)loadView{

    [super loadView];

    address =[[UITextField alloc] initWithFrame:CGRectMake(20, 50, 280, 30)];
    address.textColor=[UIColor whiteColor];
    address.backgroundColor=[UIColor grayColor];
    address.borderStyle = UITextBorderStyleRoundedRect;
    address.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    [address setFont:[UIFont boldSystemFontOfSize:12]];
    address.delegate=self;


    UIButton *btnenter =[[UIButton alloc] initWithFrame:CGRectMake(310, 50,50, 30)];
    [btnenter setTitle:@"Enter" forState:UIControlStateNormal];
    [btnenter addTarget:self action:@selector(geocode:) 
        forControlEvents:UIControlEventTouchUpInside];

    camera = [GMSCameraPosition cameraWithLatitude:0.0 longitude:0.0 zoom:2];

    mapView_ = [GMSMapView mapWithFrame:CGRectMake(20, 500, 500, 500) camera:camera];
    mapView_.myLocationEnabled = YES;
    mapView_.settings.myLocationButton = YES;

    self.view = mapView_;   
    mapView_.delegate=self;

    [self.view addSubview:address];
    [self.view addSubview:btnenter];

}

I managed to find a solution in this post: https://stackoverflow.com/a/20609357/1755778

It appears as though GMSMapView has a BlockingGestureRecognizer which prevents you from interacting with the UITextField.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM