从app delegate添加标签栏控制器时,mainView会移动

时间:2013-12-11 04:15:19

标签: ios iphone uiview uiwebview uitabbarcontroller

我正在使用下面的代码在app delegate中创建一个标签栏,但是当我运行应用程序时,我在IB中设置的视图中的所有内容都已向下移动(使用故事板)。有人有什么建议吗?

//************ Add Tab Bar ***********************************
MainViewController *controller = (MainViewController *)self.window.rootViewController;
controller.managedObjectContext = self.managedObjectContext;

self.tabController = [[SGTabsViewController alloc] init];
self.tabController.delegate = self;
self.window.rootViewController = self.tabController;
[self.window makeKeyAndVisible];

[self.tabController setToolbarHidden:NO animated:NO];
[self.tabController.view setFrame:controller.view.bounds];
[self.tabController addViewController:controller];

double delayInSeconds = 0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    [self.tabController setToolbarHidden:NO animated:NO];
});

enter image description here

0 个答案:

没有答案