【发布时间】:2020-10-23 11:04:55
【问题描述】:
我有一个 UIViewController,它包含一个 UITableView,还有一个带有大标题的导航栏。每当我向下滚动表格视图时,大标题就会消失并变成一个小标题。滚动浏览时如何保持大标题(使其成为静态/粘性)。
我添加了我的屏幕图片before the swipe、in the middle of a swipe、and 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