1

我正在尝试在应用程序启动时创建一个 presentModalViewController。我可以让 presentModalViewController 正常运行,但是当我尝试将其设置为 UINavigation 控制器时,我看到的只是一个空白的 UINavigationController。

我的班级概述定义如下:

#import <UIKit/UIKit.h>
@class Login;

@interface Overview : UINavigationController {

}

-(IBAction) btnRegistrationPressed;
-(IBAction) btnLoginPressed;


@end

然后在委托中我这样做:

- (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];

    [self.tabBarController presentModalViewController:overviewViewController animated:YES];
    [overviewViewController release];
    [self.window makeKeyAndVisible];

    return YES;
}

我还有一个 Overview.xib,我在其中从库中拖入了一个 UiNavigation 控制器。下面的视图控制器被设置为一个名为 test 的类,它将在屏幕上显示一条消息。

当我启动时,我看到的只是一个空白的 UINavigationController。

有任何想法吗?

4

1 回答 1

3

你试过像下面这样

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

}

于 2011-04-25T05:00:07.500 回答