开发者

Is it possible to make a presentModalViewController a UINavigation Controller?

开发者 https://www.devze.com 2023-02-28 17:32 出处:网络
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 i

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;

}

0

精彩评论

暂无评论...
验证码 换一张
取 消