是否可以使presentModalViewController成为UINavigation控制器?

发布于 2024-11-03 07:45:43 字数 1177 浏览 5 评论 0原文

我试图在应用程序启动时出现一个presentModalViewController。我可以使presentModalViewController 正常显示,但是当我尝试将其设为UINavigation Controller 时,我看到的只是一个空白的UINavigationController。

我的类 Overview 定义如下:

#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 Controller。下面的视图控制器被设置为一个名为 test 的类,它将在屏幕上显示一条消息。

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

有什么想法吗?

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 addSubview: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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

污味仙女 2024-11-10 07:45:43

你有没有尝试过像下面这样

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

}

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;

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文