我想知道如何在新視圖上顯示標籤控制器。iOS - 如何在新視圖上顯示標籤控制器
我有我的選項卡控制器3項:家庭,信息,幫助在回家
,有可能打開一個新的觀點,這種所謂的「測試版」的新觀點,但不顯示標籤控制器的按鈕,我不知道如何顯示標籤控制器,我不想要「測試版」作爲標籤項目雖然..
任何幫助將不勝感激。
這裏是一些代碼,我已經使用至今
//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;
}
我檢查了它是如何在appdelegate – 1303rajaryan1303
中完成的,但它使用self.window.rootviewcontroller = self.tabbarcontroller; – 1303rajaryan1303
我會建議編輯你的問題與你用來嘗試實例化UITabBar控制器的代碼。另外,你是使用故事板,XIB等? – Dan