我開始新的學習Xcode和我使用的Xcode 5.1UINavigationController和UITabBarController的關係和UIViewController是一樣的嗎?
我準備滑出式導航欄形式這一來源:
https://github.com/John-Lluch/SWRevealViewController
在此代碼則需要通過我的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;
}
,這是FrontViewController.h:
#import <UIKit/UIKit.h>
@interface FrontViewController : UITabBarController
@end
問題是否塔導航欄不能處理TabBarController?
編輯: 這是我FrontViewController UI。
我看到你的FrontViewController只是[[FrontViewController alloc] init],你有沒有添加一個childrenViewControllers到這個VC?,如果沒有,那是因爲它是空的。 – Dimentar
是的,我添加了選項卡和一些東西 – MBH