No zoom


#1

Hey All,
I am following the book and starting on page 78 I commented out
// [locationManager startUpdatingLocation];

and inserted the line
[mapView setShowsUserLocation:YES];

I then added the function
-(void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views{
//lines of code listed in book
}

When I compile my program it succeeds, but when I run my program it shows the blue dot of apple headquarters however there is no zooming going on. I looked at other posts and one of the things highlighted by many is to make sure that in Interface Builder the connections are set up correctly. I right clicked and dragged from the circle in located in “The Inspector” to the elements located to the instances located in the “UI Window”. All of the instances seem to be connected correctly.

I also placed a NSLog line in the “mapView:didAddAnnotationViews” method and it doesn’t output which leads me to believe that it’s not getting called.

Any suggestions?

Thanks!
-Patrick


#2

Hey All,
Nevermind. I set up the pointers correctly but didn’t assign the delegate for each instance.

Thanks anyways!
-Patrick


#3

I also ran into the “No Zoom” issue, and after setting various breakpoints and tracing through the code, couldn’t find the issue - as I’d typed in exactly what was in the Kindle Reader version of this book.

As Schmudu says, he didn’t assign the delegate for each instance - which pointed me in the right direction to fixing the problem (thanks, Schmudu!)

So it appears that there’s a small omission from this version:

[locationManager setDelegate:self];
[mapView setDelegate:self];

or, if you prefer

[locationManager setDelegate:self];
mapView.delegate = self;  // ;)

#4

[quote=“scbritton”]I also ran into the “No Zoom” issue, and after setting various breakpoints and tracing through the code, couldn’t find the issue - as I’d typed in exactly what was in the Kindle Reader version of this book.

As Schmudu says, he didn’t assign the delegate for each instance - which pointed me in the right direction to fixing the problem (thanks, Schmudu!)

So it appears that there’s a small omission from this version:

[locationManager setDelegate:self];
[mapView setDelegate:self];

or, if you prefer

[locationManager setDelegate:self]; mapView.delegate = self; // ;) [/quote]

I think you may have jumped to the wrong conclusion. You don’t need to add: [mapView setDelegate:self];
for the app to zoom properly. I think what schmudu meant was that he didn’t connect the appropriate delegates in Interface Builder.


#5

Hi All,

I’ve tried all of these and no zoom. Has anyone else come across this? I’ve checked all the connections and the code. Everything seems fine. When I run the app the map loads, the blue dot appears and no zoom. :frowning:


#6

i don’t have zoom too, can anyone help me please?..I did not make any changes to the code I just wrote what else is written on the book…help me


#7

Everything in the books seems to be ok. The only thing I had to do is to set the delegate for the MapView.

So right click on the map view, click on the delegate and drag it to the WhereAmI App Delegate.