基于UINavigationController的应用程序与FlipSideView和另一个UINavigationController

时间:2011-04-27 21:40:37

标签: ios uinavigationcontroller uinavigationitem flipside

我正在尝试使用这种架构开发应用程序(游戏):

  • 主视图是基于navbar hidden
  • 的naviagtioncontroller
  • 在主视图中我需要一个简单的信息 按钮显示选项/信用 flipsideview
  • 这个侧视图必须有另一个 navcotroller与右栏 按钮到“完成”系统按钮

问题是,flipsideview没有显示完成按钮,它似乎显示主导航控制器......

这是代码。

的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;

}

主视图(从XIB加载)。仅提取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。在XIB中,我只有一个空白视图,其中outlet与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

}

实施档案......

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


    #pragma mark - User Methods

    - (IBAction)done {

        [self.delegate flipsideViewControllerDidFinish:self];

    }

结果是:

  • 主视图显示没有导航 杆
  • 点击信息按钮
  • Flipsideview显示动画 和标题为“信息”而不是“pippo”的导航栏 而不是右边的“完成”按钮......

我错在哪里?

1 个答案:

答案 0 :(得分:0)

难道你没有在Flipside ViewController上获得两个带导航项目的导航栏吗?我现在正在与这个bug斗争。