Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

overlay - Google Maps iOS SDK - Add UIView/UIButton over a GMSMapView

I'm developing an iOS app with Google Maps iOS SDK with storyboard. On my main view controller in "viewDidLoad" I have implemented a GMSMapView and shows it by

self.view = mapView_;

and everything goes fine. Now I want to add a UIView or UIButton over the map, like myLocation button style. There is any solution to add it and use it via storyboard? I've overlayed objects on the map by code but i really need autolayout so manage it via Storyboard would be nice. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this (making sure you set the mapView frame to a value different than CGRectZero (which works for self.view=mapView only)):

mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
[self.view insertSubview:mapView atIndex:0];

As Saxon said, inserting the view at index 0 will set the rest of the objects in front.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...