2012-09-20 23 views
0

在我的應用程序中我有一個TabbarController。其中一個選項卡打開一個視圖,啓動iPhone攝像頭。此CameraView是另一家公司開發的SDK的一部分。所以我不能修改這個CameraView的類。 我的問題是,我必須在此CameraView中實現UINavigationBar。我已經通過annotationView解決了這個(這個導航欄不是由navigationcontroller處理):Autoresizing UINavigationBar AnnotationView

[self.annotationView addSubview:navbar]; 

一切運作良好,除了自動尺寸問題。如果我將手機轉爲橫向模式,則導航欄太短。 我已經嘗試設置Autoresizingmask,但這沒有幫助。 你有什麼想法,我可以強制導航欄自動大小?

預先感謝

回答

0

嘗試手動調整,而不是使用自轉的導航欄的幀。

-willRotateFromInterfaceOrientation:(UIInterfaceOrientation)fio toInterfaceOrientation:(UIInterfaceOrientation)tio 
{ 
    if(tio == UIInterfaceOrientationLandscape) 
     //set navbar frame 
    else 
    //... 
} 
+0

謝謝!這是正確的方式!但是我使用'(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation' – chris13

+0

shouldAutorotate ..用於指定允許哪個方向。你應該使用willAutorotate ..來改變框架。如果正確,請接受答案,thx。 :) – ale84

+0

噢好的..謝謝你的提示。現在一切正常! – chris13