iOS8上的UITabBarController打破了较小的屏幕

时间:2014-09-28 20:56:54

标签: ios objective-c iphone

似乎在3,5英寸屏幕上使用UITabBarController导致问题,因为IOS8。 我使用UITabBarController作为根控制器,每个选项卡都有自己的viewController。问题是从模态viewController返回时,tabBar消失。 这只发生在具有较小屏幕(3,5英寸)的IOS8上,并且一直适用于旧版本的IOS。

任何人都知道如何解决这个问题?

//AppDelegate.h
@property (nonatomic, strong) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, strong) IBOutlet UIWindow *window;

//----------------------------------------------- 

//AppDelegate.m
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.delegate = self;
tabBarController.view.frame = [[UIScreen mainScreen] applicationFrame];

//Set each tab to show an appropriate view controller
[tabBarController setViewControllers:[NSArray arrayWithObjects:mainViewController,aViewController,bViewController, nil]];
self.tabBarController = tabBarController;

self.window.rootViewController = self.tabBarController;

// Finally, add the tab controller view to the parent view
[window addSubview:self.tabBarController.view];

self.window.rootViewController = self.tabBarController.navigationController;
[window makeKeyAndVisible];


//----------------------------------------------- 

//launching a modal viewController from the mainViewController
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:listViewController];        
[self presentViewController:navController animated:YES completion:nil];  

//dismissing the modal viewController 
//listViewController.m
[self dismissViewControllerAnimated:YES completion:nil];

//after returing to the mainViewController the tabBar at the bottom of the screen just dissapears

0 个答案:

没有答案