Is it possible to make a presentModalViewController a UINavigation Controller?
I am trying to make a presentModalViewController come up upon launch of the app. I can make the presentModalViewController come up fine but when I try to make it a UINavigation Controller, All I see is a blank UINavigationController.
My class Overview is defined as follows:
#import <UIKit/UIKit.h>
@class Login;
@interface Overview : UINavigationController {
}
-(IBAction) btnRegistrationPressed;
-(IBAction) btnLoginPressed;
@end
Then in delegate I am doing this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the tab bar controller's view to the window and display.
[self.window a开发者_开发技巧ddSubview:tabBarController.view];
Overview *overviewViewController = [[Overview alloc] initWithNibName:@"Overview" bundle:nil];
[self.tabBarController presentModalViewController:overviewViewController animated:YES];
[overviewViewController release];
[self.window makeKeyAndVisible];
return YES;
}
I also have a Overview.xib in which I dragged in a UiNavigation Controller from library. The view controller underneath that is set to a class called test that would show a message on screen.
When I launch, all I see is a blank UINavigationController.
Any ideas?
Have you tried like following
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the tab bar controller's view to the window and display.
[self.window addSubview:tabBarController.view];
Overview *overviewViewController = [[Overview alloc] initWithNibName:@"Overview" bundle:nil];
UINavigationController *nav_obj = [[UINavigationController alloc] initWithRootViewController:overviewViewController ];
[self.tabBarController presentModalViewController:nav_obj animated:YES];
[overviewViewController release];
[self.window makeKeyAndVisible];
return YES;
}
精彩评论