iPhone: the top navigation bar pushes the Google logo on the screen

advertisements

I am new to iPhone development, please suggest the right way to rectify the below problem.

I am displaying the Google Map as below :

Now the problem is the Top Navigation bar pushes the Google logo on Map below screen and hence it is not visible, when I hide the Navigation bar, I can see the Google logo as below

Code Reference :

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.navigationController setNavigationBarHidden:YES animated:NO];

    mapView.showsUserLocation=TRUE;
    self.title [email protected]"Map View";
    mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
    mapView.showsUserLocation=TRUE;
    mapView.mapType = MKMapTypeStandard;
    mapView.delegate=self;

    /*Region and Zoom*/
    MKCoordinateRegion region;
    MKCoordinateSpan span;
    span.latitudeDelta = 0.2;
    span.longitudeDelta = 0.2;

    CLLocationCoordinate2D location=mapView.userLocation.coordinate;
    AppDelegate *appdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];    

    location.latitude = [appdelegate.RDLat doubleValue];
    location.longitude = [appdelegate.RDLng doubleValue];

    region.span=span;
    region.center=location;

    [mapView setRegion:region animated:TRUE];
    [mapView regionThatFits:region];

    ParkPlaceMark *placemark=[[ParkPlaceMark alloc] initWithCoordinate:location title:appdelegate.RestAddress];
    [mapView addAnnotation:placemark];

    [self.view insertSubview:mapView atIndex:0];

}

Now Please suggest me how to show Navigation bar without pushing the Google map below.

Any help highly appriciated


Just change below line

mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];

To

mapView = [[MKMapView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x,44,self.view.frame.size.width,self.view.frame.size.height-44)];

And It will work as charm. Let me know if it is not.