我正在尝试在应用程序启动时创建一个 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/