2016-07-16 50 views
0

我在我的項目中使用SWRevealViewController。我的應用程序有TabBarController。我這樣做,我打開菜單。當我在菜單中選擇它打開沒有TabBarController底部。我使用Storyboard。我的開始View是帶有類SWRevealViewController的ViewController。我使用標識符sw_rear和類SWRevealViewControllerSegueSetController連接到我的菜單。在菜單之前,我有導航控制器。我還使用標識符sw_front和類SWRevealViewControllerSegueSequeController將SWRevealViewController連接到我的TabBar。我究竟做錯了什麼?SWRevealViewController與TabBarController

在我的菜單來打開一看我有這樣的代碼:

BookTableViewController *m = [self.storyboard instantiateViewControllerWithIdentifier:@"Book"]; 
     [self.revealViewController pushFrontViewController:[[UINavigationController alloc] initWithRootViewController:m] animated:YES]; 
     [self.revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES]; 

回答

0

從我明白了什麼,你要正面視圖 - 控制是一個標籤欄和菜單,沒有標籤欄?

所以有三件事,前,後,右。如果你還沒有看的AppDelegate在RevealControllerExample並儘量做到以下幾點,

  1. 創建您的TabBar的實例
  2. 創建SWRevealViewController,初始化與零作爲後和你的TabBar作爲前(如果您不能使用nil作爲後端,只需創建一個UIViewController,但不會使用它)。
  3. 創建你的菜單視圖 - 控制,並將其分配到的SWRevealViewController

的rightViewController屬性如果這沒有解決您的問題,請發表評論,好運氣。

+0

我的問題是,當我在我的菜單中選擇並打開它。它打開時沒有TabBar底部。 – Ales

+0

你菜單viewcontroller需要有一個標籤欄?如果是這樣,只需將標籤欄分配給右側的ViewController。你需要菜單中的每個選項加載標籤欄嗎? – JingJingTao

+0

菜單不需要標籤欄。菜單中的其他選項(viewcontroller或tableviewcontroller)必須加載標籤欄底部。 – Ales

1
//Tabbar controller name on storyboard 
    Tabbarcontroller *tabvc=(Tabbarcontroller *)[self.storyboard instantiateViewControllerWithIdentifier:@"TabbarcontrollerVCId"]; 
    NSLog(@"tabvc controller ===>%@",tabvc.viewControllers); 

    Select viewcontollers and pass index 
    tabvc.selectedIndex=0; 

    [self.revealViewController setFrontViewController:tabvc]; 
    [self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];