当presentviewcontroller ios时,Tabbar Controller显示黑屏

时间:2016-07-26 19:47:02

标签: ios objective-c swift uitabbarcontroller

我目前正在使用tabbar应用程序,它有4个标签。当我选择其中一个标签时,我想要的行为就像Instagram点击“相机标签”时所做的那样,我通过添加下面的代码实现了它。但是当我击中标签时;它首先显示黑屏,然后显示下面的视图。如何避免不显示黑屏?

override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
   if item.title == "More" {

        let storyboard = UIStoryboard(name: "Main", bundle: nil);
        let moreView = storyboard.instantiateViewControllerWithIdentifier("moreView") as! MoreView;
        moreView.modalPresentationStyle = UIModalPresentationStyle.FullScreen;
        self.presentViewController(moreView, animated: true, completion: nil)
    }
  }

1 个答案:

答案 0 :(得分:1)

试试这个:

var next = self.storyboard?.instantiateViewControllerWithIdentifier(“moreView”)as!更多查看

取代:         let storyboard = UIStoryboard(名称:“Main”,bundle:nil);

为您要呈现的课程提供背景颜色         self.view.backgroundColor = UIColor.whiteColor()