-1
我试图在谷歌地图上添加一个UItoolbar,但地图覆盖了工具栏。有没有可能在谷歌地图上制作工具栏?
即使我将地图视图添加为子视图,地图视图也不会显示任何内容。在Google地图上制作工具栏是不可能的?
其他信息:
var camera:GMSCameraPosition = GMSCameraPosition()
var mapView:GMSMapView = GMSMapView()
override func viewDidLoad() {
super.viewDidLoad()
let manager = CLLocationManager()
if CLLocationManager.locationServicesEnabled() {
manager.startUpdatingLocation()
}
if CLLocationManager.authorizationStatus() == .NotDetermined {
manager.requestAlwaysAuthorization()
}
camera = GMSCameraPosition.cameraWithLatitude(lat,longitude:long, zoom:17.5, bearing:30, viewingAngle:40)
mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)
var marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(lat, long)
marker.appearAnimation = kGMSMarkerAnimationPop
marker.title = locationName
if let mylocation = mapView.myLocation {
NSLog("User's location: %@", mylocation)
} else {
NSLog("User's location is unknown")
}
mapView.myLocationEnabled = true
self.view = mapView
// self.view.addSubview(mapView)
let toolbar: UIToolbar = UIToolbar()
toolbar.frame = CGRectMake(0, self.view.frame.size.height - 48, self.view.frame.size.width, 48)
toolbar.sizeToFit()
toolbar.backgroundColor = UIColor.redColor()
self.view.addSubview(toolbar)
}
对不起,这不适合我的情况。感谢您的帮助。导航控制器已经通过parentController推送了mapview控制器。 –
你可以尝试self.hidesBottomBarWhenPushed = NO; self.toolbarHidden = NO; – johndpope