我想知道如何在新视图上显示选项卡控制器。
我的标签控制器上有 3 个项目:主页、信息、帮助
在主页上,有一个按钮可以打开一个新视图,这个新视图称为“beta”,但不显示选项卡控制器,我不知道如何显示选项卡控制器,但我不希望“beta”作为选项卡项。 .
任何帮助将不胜感激。
这是我到目前为止使用的一些代码
//this is in appdelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
UIViewController *viewController2 = [[InformViewController alloc] initWithNibName:@"InformViewController" bundle:nil];
UIViewController *viewController3 = [[HelpViewController alloc] initWithNibName:@"HelpViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
//this opens the new view called beta
@implementation HomeViewController
-(IBAction)Showbeta
{
betaViewController *betaViewController = [[betaViewController alloc] initWithNibName:nil bundle:nil];
[self presentViewController:betaViewController animated:YES completion:NULL];
}
//this is in betaviewcontroller
@interface betaViewController ()
@end
@implementation betaViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
// self.window.rootViewController = self.tabBarController; --> this did not work
}
return self;
}