XTL
XTL

Reputation: 1452

Google Maps SDK Xamarin.iOS show MapView in UIView via Storyboard

I'm using Google Maps SDK for my Xamarin.iOS app and i got an problem.

I want to put MapView into specific UIView(that was created on Storyboard) and that is no so easy as expected.

At current moment i have tried to put MapView class into my UIView class(in native iOS Development its an solution),but it didn't worked.

Also i have tried to do something like this:

//init google SDK stuff
MyViewWhereIWantToPutGoogleMaps.AddSubview(MapView); // and the same,no effect  

Any ideas? Thanks.

Upvotes: 2

Views: 595

Answers (1)

pinedax
pinedax

Reputation: 9356

Remember you need to indicate the CGRect for the MapView object.

If you want it to cover the whole space in MyViewWhereIWantToPutGoogleMaps you just do:

var frame = MyViewWhereIWantToPutGoogleMaps.Frame;
var googleMaps = new Google.Maps.MapView (new CoreGraphics.CGRect(0, 0, frame.Width, frame.Height));

MyViewWhereIWantToPutGoogleMaps.AddSubview (googleMaps);

Hope this helps.-

Upvotes: 7

Related Questions