0
votes

I have a silly question to ask and the question is that i have been working with MapKit Framework and found that whenever i am setting the frames and mapType of the object of MKMapView in the init method i get a blank view but when i set the frame and mapType in the loadView method i can view the map interface.

Why is this so? i am using sdk 3.1

Please help

here's my code

- (void)loadView {
    [super loadView];
    mymapView = [[MKMapView alloc]initWithFrame:self.view.bounds];

    mymapView.mapType = MKMapTypeStandard;

    mymapView.showsUserLocation = YES;

    [self.view addSubview:mymapView];
}

1
Is the map view loaded from a xib? Are you instantiating a map view in loadView, or accessing the map view outlet set in interface builder? - freespace
no i am using code no IB - Radix
The above code i pasted does not contain any errors but the question is why is it in loadView why not in init - Radix

1 Answers

0
votes

use debbuging pointer for checking init method calls or not.I think init method does not call

but viewDidLoad always call thats why this happens.

you can also use according to you that means show map in init by simply calling init in viewDidLoad.