我有一个带有5个标签的UITabBarController。我希望能够在Tab栏上方的所有选项卡上显示ViewController。目前我遇到的问题是,当我以模态方式呈现ViewController时,它是不可见的。每当我在tableView中选择一行时,我都会调用此函数:
调用showPlayerView
的tableView定义如下:
class SearchResultsTableView: UIView, UITableViewDataSource, UITableViewDelegate
类searchResultsTableView
是另一个类中定义的视图:
TestViewController: UIViewController, UserSearchDelegate, UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource, UINavigationBarDelegate, UINavigationControllerDelegate
这是实际功能:
func showPlayerView() {
let playerView = PlayerView()
playerView.modalPresentationStyle = .overCurrentContext
CustomTabBarController.sharedInstance?.present(playerView, animated: true, completion: {
})
}
我设置了CustomTabBarController sharedInstance,如下所示:
static var sharedInstance : CustomTabBarController?
和viewDidLoad()
里面我有这个:
CustomTabBarController.sharedInstance = self
为什么我看不到我的模态ViewController,如何让它在所有屏幕上显示?
答案 0 :(得分:0)
func showPlayerView() {
let playerView = PlayerView()
playerView.modalPresentationStyle = .overCurrentContext
CustomTabBarController.sharedInstance?.tabBarController?.tabBar.hidden = true // This will hide tab bar of your UITabbarViewController.
CustomTabBarController.sharedInstance?.present(playerView, animated: true, completion: {
})
}
// Make it visible in ViewWillApear method by below line
CustomTabBarController.sharedInstance?.tabBarController?.tabBar.hidden = false