weak var collectionView: UICollectionView?
override func viewDidLoad() {
super.viewDidLoad()
let navigationitem = UINavigationItem(title: "") //creates a new item with no title
navigationitem.titleView = collectionView //your collectionview here to display as a view instead of the title that is usually there
self.navigationController?.navigationBar.items = [navigationitem] //adds the navigation item to the navigationbar
}
1条答案
按热度按时间kmynzznz1#
这是一个collectionview,您可以通过在NavigationBar中添加collectionview来实现此目的
如需更多帮助,请查看此answer