2012-12-14 23 views
6

當用戶點擊我的通用應用程序的iPad端導航欄中的「設置」按鈕時,我需要提供一個viewController作爲。該視圖被稱爲「SettingsViewController」,它是我的iPad Storyboard中的一個視圖控制器,其ID爲「settings」。iPad的presentViewController始終是全屏(需要formSheet)iOS6

我不使用塞格斯因爲在我的iPad版應用程序的,我在左側導航欄中的多個按鈕,所以我要progammatically添加按鈕。 (無法將連線連接到故事板中不存在的UIBarButtonItem。)

我想要的功能就在那裏,演示文稿不是。 當我在iPad上展示我的SettingsViewController時,它呈現爲全屏視圖。 我需要它是一個表單。

我包裝它在一個NavigationController,我需要和工作正常,只需要它來呈現自己以正確的方式。

這裏呈現的視圖代碼:我已經試過所有我能想到的

-(void)showSettings:(id)sender { 

    SettingsViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:@"settings"]; 
    svc.delegate = self; 
    svc.modalPresentationStyle = UIModalPresentationFormSheet; 
    UINavigationController *navcont = [[UINavigationController alloc] initWithRootViewController:svc]; 
    [self presentViewController:navcont animated:YES completion:NULL]; 

} 

。任何幫助深表謝意。

回答

20

看起來像您在SettingsViewController上設置了模式演示樣式,但您應該在UINavigationController上設置它。

+1

是的,就是這樣。謝謝。 – jhilgert00

6
navcont.modalPresentationStyle = UIModalPresentationFormSheet;