2011-06-29 24 views
4

我是iPhone新手,請 建議糾正以下問題的正確方法。iPhone:頂級導航欄將Google標誌推下屏幕

我 顯示谷歌地圖如下:

enter image description here

現在的問題是在頂部導航 欄按下下面的屏幕地圖 谷歌標誌,因此它是不 可見,當我隱藏導航 吧,我可以看到谷歌標識爲 ,低於

enter image description here

代碼參考:

- (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]; 

} 

現在請建議我如何展示 導航欄不用按以下 谷歌地圖。

任何幫助高度appriciated

+1

Whaha,我剛剛發佈這個問題! (相隔2分鐘) – LouwHopley

+0

噢,你是否在Interface Builder中添加了一切? – LouwHopley

回答

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)]; 

,也將努力爲魅力。讓我知道如果它不是。

+0

非常感謝你!我已經取代了它,但現在白色補丁來到導航欄下方..白色補丁與導航欄的大小相同,我需要在代碼snipet中進行一些修改.. –

+0

您是否刪除了導航欄?或改變導航欄的風格? – Deeps

+0

嗨深淵得到它,我只是做了-44,每件事情都按預期工作..感謝您的幫助! –

0

的問題是您的視圖的大小:它太大了。 如果使用界面構建器構建了視圖,則必須在屬性面板中將的頂欄屬性設置爲導航欄。這應該會自動調整您的視圖的大小。確保您的地圖視圖也調整大小。