简体   繁体   English

无法在文本字段中输入文本

[英]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 我设法在这篇文章中找到一个解决方案: https : //stackoverflow.com/a/20609357/1755778

It appears as though GMSMapView has a BlockingGestureRecognizer which prevents you from interacting with the UITextField. GMSMapView似乎具有BlockingGestureRecognizer,它阻止您与UITextField进行交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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