iphone - 是否可以将当前的 Modal ViewController 设为 UINavigationController?

标签 iphone ios uinavigationcontroller presentmodalviewcontroller

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

我的类(class)概述定义如下:

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

@interface Overview : UINavigationController {

}

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


@end

然后在委托(delegate)中我这样做:
- (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 。下面的 View Controller 被设置为一个名为 test 的类,它将在屏幕上显示一条消息。

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

有任何想法吗?

最佳答案

你试过像下面这样

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

}

关于iphone - 是否可以将当前的 Modal ViewController 设为 UINavigationController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5775248/

相关文章:

ios - 获取 UITableView 中最后一行的索引路径

ios - UINavigationBar 中的雪佛龙在显示弹出窗口时不会变暗

iphone - 为 iOS 编译 pHash

iphone - iOS:无法向 UINavigationBar 添加阴影

html - 即使使用所有可能的格式,自定义字体也无法在 iOS 上运行

iphone - UI导航按钮更改

iphone - 如何将选定的 uitableviewcell 变量传递给以前的 View Controller ?

ios - 如何从 Struct Swift 中显示一个字符串

iPhone:获取视频信息

iphone - 尝试在我的应用程序中实现网络错误警报?