views:

32

answers:

1

Hi,

I have been coding and testing an app which uses a navigation controller, tab bar and table views together as shown in this tutorial video:

I have also coded a MapView page which shows custom annotations. This seems to work fine in every version of the simulator I have tried it on. This morning I have finally got the app running on my Ipod Touch which runs OS 3.1.3 - everything works as expected except the map does not seem to allow user interaction at all. I cannot tap on annotations, the current location or move and zoom at all.

I have been through all the settings in the Interface Builder for the mapview, and made sure that all the 'User Interaction', 'Allow Multitouch' boxes have been ticked. This doesn't seem to change anything.

Any help greatly appreciated.

The Mapview is put into the view as follows:

// Grab the maps view controller ready for loading
MapView *childController = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];
childController.title = @"View on Map";

// Push the new view controller onto the stack
[self.navigationController pushViewController:childController animated:YES];

[childController release];
childController = nil;

I've also tried running the view in a modal view controller just to see what would happen. The view was shown and any interaction didnt seem to work - with the exception of a small section at the bottom where I made the view itself slightly shorter so it would fit in above the tab bar. This section seems to have another map underneath my view which DOES respond to user interaction. So there is a 1cm or so block which does move - my view seems to stay static on top of it, though.

The view underneath does not appear to have any annotations or the current user location.

A: 

Ok I've solved this one:

In the mapview.m file where I set up the view and load the annotations, within the viewDidLoad function I had the following code:

- (void)viewDidLoad {

    // More code before this..

    [mapView addAnnotations: eventPoints];

    // This is causing the problems on the ipod touch.
    // The view is added ON TOP of the first map..
    //[self.view addSubview:mapView];
    self.view = mapView;

    // More code after this..
}

Where mapView is

IBOutlet MKMapView *mapView;

Adding a subview on top of the current view didn't want to work. Actually setting the view to be the new updated view with annotations seems to work fine. It's still strange that the simulator would work and not the device in the first place though.

Hope this helps someone.

mattGWS