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

时间:2014-03-18 16:52:34

标签: ios iphone uitextfield

我在谷歌地图上工作,我在文本字段中输入文本并根据文本输入查找位置但不幸的是我无法在文本字段中输入文本。我知道这可能是一个非常小的问题但是我无法弄明白。我也试图在网上找到它。

任何人都可以帮助我吗?

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

}

1 个答案:

答案 0 :(得分:0)

我设法在这篇文章中找到了解决方案:https://stackoverflow.com/a/20609357/1755778

好像GMSMapView有一个阻止你与UITextField交互的BlockingGestureRecognizer。