Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Why is my MKMapView null?

$
0
0

Hi folks,

I'm trying set a simple property on an MKMapView. I've used IB to 'drop' the MKMapView onto my .. er.. view (is that the right term?). I then made an outlet for that MKMapView (control + drag-click to the .h file).

In my .cs code, the outlet exists (and it exists also in the .designer file).

So it feels like the xcode <=> xam bridge did it stuff.

[Outlet]
MonoTouch.MapKit.MKMapView MapView { get; set; }

I then have the following code:

public override void ViewDidLoad()
{
    LoggingService.Trace("MapViewController ViewDidLoad");
    base.ViewDidLoad();
    MapView.ShowsUserLocation = true; // Yes, i know I can set this property in IB, also.
    ....
}

MapView instance is null, so trying to set a property on that instance, crashes the app.

Also, if I comment out this method:

//        public override void LoadView()
//        {
//        }

I get the following crash: Failed to find selector loadView on blah....

Er.. WTF?

Can anyone at all, help?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>