iPhone:顶部导航栏将Google徽标向下推到屏幕上

时间:2011-06-29 08:12:43

标签: iphone google-maps map

  

我是iPhone开发的新手   建议纠正以下问题的正确方法。

     我是   显示Google地图如下:

enter image description here

  

现在问题是顶部导航   栏在地图上推送Google徽标   在屏幕下方,因此不是   当我隐藏导航时可见   吧,我可以看到谷歌的标志   以下

enter image description here

  

代码参考:

- (void)viewDidLoad
{
    [super viewDidLoad];

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

    mapView.showsUserLocation=TRUE;
    self.title =@"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];

}
  

现在请建议我如何展示   导航栏没有推动   谷歌地图如下。

     

任何高度关注的帮助

2 个答案:

答案 0 :(得分:1)

只需更改以下行

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

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

它将起到魅力的作用。如果不是,请告诉我。

答案 1 :(得分:0)

问题在于视图的大小:它太大了。 如果使用界面构建器构建视图,则必须在属性面板中将UIView顶栏属性设置为导航栏。这应该会自动调整视图大小。确保您的地图视图也已调整大小。