【发布时间】:2016-02-17 08:20:41
【问题描述】:
我在我的应用程序中使用 GMSPlacePicker。它有一个非常简单的 API:
CLLocationCoordinate2D center = currentLocation.coordinate;
CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(center.latitude + 0.02, center.longitude + 0.02);
CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(center.latitude - 0.02, center.longitude - 0.02);
GMSCoordinateBounds *viewport = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast
coordinate:southWest];
GMSPlacePickerConfig *config = [[GMSPlacePickerConfig alloc] initWithViewport:viewport];
_placePicker = [[GMSPlacePicker alloc] initWithConfig:config];
[_placePicker pickPlaceWithCallback:^(GMSPlace *place, NSError *error) {
}];
此时它会自动从 ViewController 中显示出来。还有一个搜索功能,允许用户使用文本搜索地点。
但是,我的应用主题是黑色的,并且我使用 UIAppearance 代理设置了导航栏颜色:
[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setTranslucent:NO];
这会导致搜索出现问题,因为导航栏背景为黑色,因此无法看到搜索文本。
我也尝试按照here 的建议使用 UIAppearance 代理,但没有效果。
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor whiteColor]];
【问题讨论】:
标签: ios objective-c google-maps-sdk-ios gmsplacepicker