2015-08-26 44 views
0

我創建了使用Sw以編程方式顯示的標籤欄和側邊菜單,但是在實現所有過程後,我無法查看側面菜單,我的標籤欄也消失了......我不知道如何分配他們請求幫助我已創建的標籤欄和側邊菜單問題

@implementation AppDelegate 
@synthesize window = _window; 
@synthesize viewController = _viewController; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    // Override point for customization after application launch. 
    self.tabBarController =[[UITabBarController alloc]init]; 

    //Initialize View controller and speciality 
    UIViewController *viewcontroller1=[[HomeView alloc]init]; 
    UIViewController *viewcontroller2=[[Speciality alloc]init]; 
    UIViewController *viewcontroller3=[[Activity alloc]init]; 
    UIViewController *viewcontroller4 =[[Notification alloc]init]; 
    UIViewController *viewcontroller5 =[[Profile alloc]init]; 

    self.tabBarController.viewControllers=[NSArray arrayWithObjects:viewcontroller1,viewcontroller2,viewcontroller3,viewcontroller4,viewcontroller5, nil]; 
    self.window.rootViewController =self.tabBarController; 
    self.tabBarController.tabBar.barTintColor = [UIColor colorWithRed:0.376 green:0.729 blue:0.318 alpha:1.000]; 

    self.window.backgroundColor = [UIColor whiteColor]; 
    HomeView *frontViewController = [[HomeView alloc] init]; 
    RearViewController *rearViewController = [[RearViewController alloc] init]; 
    UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController]; 
    UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearViewController]; 
    SWRevealViewController *mainRevealController = [[SWRevealViewController alloc]initWithRearViewController:rearNavigationController frontViewController:frontNavigationController]; 
    mainRevealController.delegate = self; 
    self.window.rootViewController = self.viewController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

回答

0

您設置window.rootViewController兩次。而且它似乎是第二次將它分配給nil,因爲我看不到self.viewController的任何初始化/分配。

+0

我在一個視圖控制器中創建了標籤欄和側邊菜單如何在一個視圖控制器中調用它們 – Arun

+0

使用容器視圖控制器。請參閱https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/中的「實現容器視圖控制器」。 –