【问题标题】:Keep TabBar Large Title on swipe swift快速滑动时保持 TabBar 大标题
【发布时间】:2020-10-23 11:04:55
【问题描述】:

我有一个 UIViewController,它包含一个 UITableView,还有一个带有大标题的导航栏。每当我向下滚动表格视图时,大标题就会消失并变成一个小标题。滚动浏览时如何保持大标题(使其成为静态/粘性)。

我添加了我的屏幕图片before the swipein the middle of a swipeand after the swipe.

即使在滑动发生后,我也想保持在before the swipe 图像中看到的大标题。

我目前在导航栏(大标题和透明度)方面的代码如下

类 OneChallengeViewController: UIViewController {

@IBOutlet weak var tableView: UITableView!
let productCellId = "TableViewCell1TableViewCell"
var products = [ProductDto]()

override func viewDidLoad() {
 super.viewDidLoad()
 
 
 navigationController?.navigationBar.prefersLargeTitles = true
 navigationItem.title = "Challenges"
 navigationController?.navigationBar.barStyle = .default
 navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
 navigationController?.navigationItem.largeTitleDisplayMode = .always



 }

【问题讨论】:

    标签: ios swift uitableview uinavigationcontroller uitabbarcontroller


    【解决方案1】:

    只要根视图是可滚动的,标题就会在滚动时折叠,即是一个滚动视图或嵌入了UIScrollView的视图。

    要在特定情况下实现您想要的,您需要在视图层次结构中的 tableView 之前添加一个虚拟视图。

    我在搜索如何实现相反的目标时发现了您的问题 ?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-28
      • 2014-10-31
      • 1970-01-01
      • 2019-01-02
      • 1970-01-01
      • 1970-01-01
      • 2012-12-20
      • 2014-12-27
      相关资源
      最近更新 更多