当导航控制器按下时,IIViewDeckController不工作

时间:2015-10-06 07:05:42

标签: ios objective-c xcode iiviewdeckcontroller

请帮助我完成我的项目。我正在使用IIViewDeckController,但在视图控制器

推送时它不起作用

继承层次结构:

ViewController(推送)----> IIViewDeckController(使用左视图和中心视图)。

这是初始化IIViewDeckController时的代码:

- (IIViewDeckController*)generateControllerStack{

self.navigationView = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];
self.profileView = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];

UINavigationController* navC = [[UINavigationController alloc] initWithRootViewController:self.profileView];


IIViewDeckController *deckView = [[IIViewDeckController alloc] initWithCenterViewController:navC leftViewController:self.navigationView rightViewController:nil];

deckView.leftSize = 50;

[deckView disablePanOverViewsOfClass:NSClassFromString(@"_UITableViewHeaderFooterContentView")];

return deckView;

}

然后当我使用另一个ViewController

推送IIViewDeckController时,这是我的代码
- (IBAction)signInAction:(id)sender {

IIViewDeckController *deckView = [[UIManager sharedItems] generateControllerStack];

[self.navigationController pushViewController:deckView animated:YES];

}

非常感谢你们:)

enter image description here

当我点击登录时,我会将我的iiviewdeckcontroller推向左侧和中央视图,这将显示

enter image description here

3 个答案:

答案 0 :(得分:0)

你可以这样做。

//Appdelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController"
                                                       bundle:nil];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
return YES;

}

IIViewDeckController.h中导入ViewController.h,然后

- (IBAction)GoToNext:(id)sender 
{
        IIViewDeckController *objIIVC = [self.storyboard instantiateViewControllerWithIdentifier:@"Your VC's Identifier"];
        [self.navigationController pushViewController:objIIVC animated:YES];

}

答案 1 :(得分:0)

你是这样创造的吗? 我使用它作为根视图控制器。它工作正常

    UINavigationController* navController=(UINavigationController*)[[UIStoryboard storyboardWithName:@"Main" bundle: nil] instantiateViewControllerWithIdentifier:@"HomeViewController"];

    SlideMenuViewController* slide=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SlideMenuViewController"]; /


    IIViewDeckController* deckController =  [[IIViewDeckController alloc] initWithCenterViewController:navController
                                                                                    leftViewController:slide
                                                                                   rightViewController:nil
                                                                                     topViewController:nil
                                                                                  bottomViewController:nil];

    float leftSize=self.window.frame.size.width - (88*self.window.frame.size.width)/320;
    deckController.panningMode = IIViewDeckFullViewPanning;
    deckController.leftSize =leftSize;

答案 2 :(得分:0)

这是我的代码

- (IIViewDeckController *)generateControllerStack {

self.navigationView = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];


UIViewController *centerController = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
centerController = [[UINavigationController alloc] initWithRootViewController:centerController];


self.viewDeck = [[IIViewDeckController alloc] initWithCenterViewController:centerController leftViewController:self.navigationView rightViewController:nil topViewController:nil bottomViewController:nil];

self.viewDeck.leftSize = 50;

[self.viewDeck disablePanOverViewsOfClass:NSClassFromString(@"_UITableViewHeaderFooterContentView")];

return self.viewDeck;

}