简体   繁体   English

UINavigationController 基于应用程序,带有 FlipSideView 和另一个 UINavigationController

[英]UINavigationController based app with FlipSideView with another UINavigationController

I'm trying to develop an app (game) with this architecture:我正在尝试使用这种架构开发一个应用程序(游戏):

  • Main view is a naviagtioncontroller based with navbar hidden主视图是基于隐藏导航栏的导航控制器
  • in Main view I need a light info button to show a options/credits flipsideview在主视图中,我需要一个灯光信息按钮来显示选项/信用翻转视图
  • this flipsideview must have another navigationcotroller with a right bar button to a "Done" system button这个翻转视图必须有另一个带有右栏按钮到“完成”系统按钮的navigationcotroller

The problem is that the flipsideview doesn't show the done button and it seems to show the Main navigation controller...问题是flipsideview没有显示完成按钮,它似乎显示主导航controller ...

This is the code.这是代码。

AppDelegate:应用委托:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    // Override point for customization after application launch.
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;

}

Main View (loaded from a XIB).主视图(从 XIB 加载)。 Extract only of showInfo:仅提取 showInfo:

-(IBAction) showInfo:(id)sender {

    FlipSideViewController *controller = [[FlipSideViewController alloc] initWithNibName:@"FlipSideView" bundle:nil];
    controller.delegate = self;
    controller.title = @"Info";

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
    navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    navController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonItemStyleDone 
                                                                                target:controller action:@selector(done:)];

    navController.navigationItem.rightBarButtonItem = doneButton;
    controller.navController = navController;    
    [self presentModalViewController:navController animated:YES];

    [doneButton release];
    [controller release];
    [navController release];

}



- (void)flipsideViewControllerDidFinish:(FlipSideViewController *)controller {
    [self dismissModalViewControllerAnimated:YES];
}

FlipSideView.翻转侧视图。 In the XIB I've only a blank view with outlet linked to the UIViewController view.在 XIB 中,我只有一个空白视图,其插座链接到 UIViewController 视图。

@protocol FlipsideViewControllerDelegate;

@interface FlipSideViewController : UIViewController {

    id <FlipsideViewControllerDelegate> delegate;

    UINavigationController *navController;

}


@property (nonatomic,assign) id <FlipsideViewControllerDelegate> delegate;
@property (nonatomic,retain) UINavigationController *navController;

-(IBAction)done;

@end

@protocol FlipsideViewControllerDelegate
- (void)flipsideViewControllerDidFinish:(FlipSideViewController *)controller;
@end

}

Implementation file...执行文件...

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navController.navigationItem.title = @"Pippo";
}


    #pragma mark - User Methods

    - (IBAction)done {

        [self.delegate flipsideViewControllerDidFinish:self];

    }

The result is:结果是:

  • Main View showing without navigation bar显示没有导航栏的主视图
  • Click on info button点击信息按钮
  • Flipsideview showing with animation and navigation bar with title "Info" and not "pippo and not "Done" button on the right... Flipsideview 显示 animation 和导航栏标题“信息”而不是“pippo”而不是“完成”按钮在右侧...

Where am I wrong??我哪里错了??

Don't you get two navigationBar with navigationItems on FlipsideViewController?你没有在 FlipsideViewController 上得到两个带有 navigationItems 的 navigationBar 吗? I am fighting with this bug now.我现在正在与这个错误作斗争。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将uinavigationcontroller推入另一个uinavigationcontroller - How to push the uinavigationcontroller into another uinavigationcontroller 解散UINavigationController并呈现另一个UINavigationController - Dismissing a UINavigationController and Presenting another UINavigationController 基于iOS UINavigationController的应用程序方法 - iOS UINavigationController-based app approach UINavigationController 的 RootViewController 没有被释放,而 UINavigationController 由另一个 UINavigationController 提供 - RootViewController of UINavigationController not getting deallocated while UINavigationController is presented by another UINavigationController 在另一个UINavigationController内部的UITabBarController内部的UINavigationController问题 - Issue with a UINavigationController inside a UITabBarController inside another UINavigationController 是否可以从另一个 UINavigationController 提供 UINavigationController? - Is it possible to present an UINavigationController from another UINavigationController? 将基于UINavigationController的应用程序转换为基于UIDocumentBrowser的应用程序 - Convert UINavigationController-based app to UIDocumentBrowser-based app WKWebView和UINavigationController导致应用程序崩溃 - App crashes with WKWebView and UINavigationController UINavigationController:应用程序冻结 - UINavigationController: app freezes 应用程序中的持久 header 与 UINavigationController - Persistent header in app with UINavigationController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM