[英]UINavigationController based app with FlipSideView with another UINavigationController
I'm trying to develop an app (game) with this architecture:我正在尝试使用这种架构开发一个应用程序(游戏):
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:结果是:
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.