View on Top of UITabBar

后端 未结 7 1785
慢半拍i
慢半拍i 2021-02-02 16:03

Similar to what the Spotify or Apple Music app does when a song is playing, it places a custom view on top of the UITabBar:

Solutions I\'ve tried:

  1. UITa

7条回答
  •  南方客
    南方客 (楼主)
    2021-02-02 16:56

    Since iOS 11 this became a little easier. When you add your view, you can do the following:

    viewControllers?.forEach {
       $0.additionalSafeAreaInsets = UIEdgeInsets(
          top: 0, 
          left: 0,
          bottom: yourView.height,
          right: 0
       )
    }
    

提交回复
热议问题