在Google Maps SDK for iOS中使用文本字段

时间:2015-05-01 20:29:37

标签: ios google-maps-sdk-ios

我正在尝试在谷歌地图视图中添加一个简单的文本字段。文本字段正在显示,但我无法在其中写入/输入任何内容。键盘也没出现..请帮我解决这个问题。

这就是我正在做的事情:

//Add text field
UITextField *textField = [[UITextField alloc] init];
textField.frame = CGRectMake(mapView_.bounds.size.width - 290, mapView_.bounds.size.height - 48, 180, 40);
textField.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.font = [UIFont systemFontOfSize:15];
textField.placeholder = @"Testing...";
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.keyboardType = UIKeyboardTypeDefault;
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.delegate = self;
textField.userInteractionEnabled = YES;

[self.view addSubview: textField];

1 个答案:

答案 0 :(得分:0)

self.view.insertSubview(TextField,aboveSubview:self.mapView)