我正在尝试使用这种架构开发应用程序(游戏):
问题是,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];
}
结果是:
我错在哪里?
答案 0 :(得分:0)
难道你没有在Flipside ViewController上获得两个带导航项目的导航栏吗?我现在正在与这个bug斗争。