【问题标题】:Scrollview in navigation导航中的滚动视图
【发布时间】:2020-10-13 20:28:57
【问题描述】:

伙计们,我想为我的应用制作这个屏幕。我不知道如何以编程方式将此滚动视图变成导航。请我想让这个滚动视图以编程方式进行类似的设计。

【问题讨论】:

    标签: ios swift uiscrollview uinavigationcontroller programmatically


    【解决方案1】:

    这是一个集合视图,您可以通过在 NavigationBar 中添加一个集合视图来实现这一点

    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
    }
    

    如需更多帮助,请查看answer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多