Tabbar控制器显示黑色屏幕时presentviewcontroller ios
问题描述:
我目前正在使用tabbar应用程序,它有4个选项卡。当我选择其中一个标签时,我希望像Instagram那样通过添加下面的代码来点击“摄像机选项卡”时的行为。但是当我点击标签时,它先显示黑屏,然后显示下面的视图。我怎样才能避免不显示黑屏?Tabbar控制器显示黑色屏幕时presentviewcontroller ios
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)
}
}
答
试试这个:
VAR未来= self.storyboard .instantiateViewControllerWithIdentifier( “更多查看”)作为?!更多视图
取代: 让storyboard = UIStoryboard(名称:“Main”,bundle:nil);
给背景色为您呈现 self.view.backgroundColor = UIColor.whiteColor()
同样的事情still.also我感动的实施,故事板类,但它的行为是相同的。 – lifemoveson
所以问题是当我选择标签项“更多”;有更多视图呈现的这个背景视图。当我取消moreview,并留在同一个标签,我看到有一个黑色的背景视图。如果我选择背景为白色;它会使MoreView变成白色而不是背景视图。 – lifemoveson
刚刚创建了一个演示代码。工作正常。可以分享它给我发邮件编号 – Shemona