Ios UINavigationController和UIAbbarController的关系是否与UIViewController相同?

Ios UINavigationController和UIAbbarController的关系是否与UIViewController相同?,ios,iphone,objective-c,xcode,uinavigationcontroller,Ios,Iphone,Objective C,Xcode,Uinavigationcontroller,我刚开始学习xCode,现在正在使用xCode 5.1 我已准备好从以下来源滑出导航栏: 在此代码中,需要将my UIViewController作为如下参数传递: FrontViewController *frontViewController = [[FrontViewController alloc] init]; UINavigationController *frontNavigationController = [[UINavigationController alloc] ini

我刚开始学习xCode,现在正在使用xCode 5.1

我已准备好从以下来源滑出导航栏:

在此代码中,需要将my UIViewController作为如下参数传递:

FrontViewController *frontViewController = [[FrontViewController alloc] init];
UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
当我这样做时,我会得到以下结果:

这也是AppDelegate.m代码:

#import "AppDelegate.h"
#import "SWRevealViewController.h"
#import "RearViewController.h"
#import "CustomAnimationController.h"
   #import "FrontViewController.h"
  @interface AppDelegate()<SWRevealViewControllerDelegate>
 @end
@implementation AppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window = window;

    RearViewController *rearViewController = [[RearViewController alloc] init];

        FrontViewController *frontViewController = [[FrontViewController alloc] init];
UINavigationController *frontNavigationController = [[UINavigationController alloc]     initWithRootViewController:frontViewController];

    UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearViewController];

    SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];

    revealController.delegate = self;

    //revealController.bounceBackOnOverdraw=NO;
    //revealController.stableDragOnOverdraw=YES;

    //self.viewController = revealCont;
    self.viewController = revealController;

    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}
#导入“AppDelegate.h”
#导入“SWRevealViewController.h”
#导入“RearViewController.h”
#导入“CustomAnimationController.h”
#导入“FrontViewController.h”
@接口AppDelegate()
@结束
@实现AppDelegate
@合成窗口=_窗口;
@综合视图控制器=_视图控制器;
-(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
{
UIWindow*窗口=[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]边界]];
self.window=窗口;
RearViewController*RearViewController=[[RearViewController alloc]init];
FrontViewController*FrontViewController=[[FrontViewController alloc]init];
UINavigationController*frontNavigationController=[[UINavigationController alloc]initWithRootViewController:frontViewController];
UINavigationController*rearNavigationController=[[UINavigationController alloc]initWithRootViewController:rearViewController];
SWRevealViewController*revealController=[[SWRevealViewController alloc]initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];
revealController.delegate=self;
//revealController.bounceBackOnOverdraw=否;
//revealController.stableDragOnOverdraw=是;
//self.viewController=revealCont;
self.viewController=revealController;
self.window.rootViewController=self.viewController;
[self.window makeKeyAndVisible];
返回YES;
}
这是FrontViewController.h:

#import <UIKit/UIKit.h>

 @interface FrontViewController : UITabBarController

 @end
#导入
@界面FrontView控制器:UITabBarController
@结束
是导航栏无法处理TabBarController的问题吗

编辑: 这是我的FrontViewController用户界面。 我认为您的问题是-(id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil,即尝试从XIB初始化VC,我的尝试失败

然后我试着成功:

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window = window;

UIViewController *firstVC = [UIViewController new];
firstVC.title = @"Title 1";

UIViewController *secondVC = [UIViewController new];
secondVC.title = @"Title 2";

UITabBarController *frontViewController = [[UITabBarController alloc] init];
[frontViewController setViewControllers:@[firstVC, secondVC]];

UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];

self.window.rootViewController = frontNavigationController;
[self.window makeKeyAndVisible];

return YES;
}
你可以将你的VC放入故事板,给他一个标识符,然后调用:

 UITabBarController *tagTBC = [self.storyboard instantiateViewControllerWithIdentifier:@"tagViewController"];

您正在将
FrontViewController
嵌入
UINavigationController
中,这是苹果不允许的。苹果公司对此总是说不。所以你们可以看看这个教程。完成后,尝试将其嵌入
SWRevealViewController

本教程基本上只是展示了如何实现
UITabController
UINavigationController
,但没有给出问题的实际答案


根据苹果的规定,你想要实现的实际上是不允许的。因此,您可以将
SWRevealViewController
嵌入
UITabController
中,也可以删除
UITabController
,使用
UIView
UIButton
创建自定义选项卡栏,并更改
UIButton
的-(iAction)上的选项卡视图。

我看到您的FrontViewController只是[[FrontViewController alloc]init],您是否已将ChildrenViewController添加到此VC?如果没有,那是因为它是空的。是的,我添加了选项卡和一些内容您也可以简单地使用
UITabBar
,而不使用
UITabBarController
,这可以实现此功能。