是的,我已经阅读了很多关于这个问题的其他帖子,这些解决方案对我来说都没有用!
基本上,当我使用viewForFooterInSection和heightForFooterInSection时,生成的页脚"浮动"
viewDidLoad和FooterView代码:
override func viewDidLoad() {
super.viewDidLoad()
setupNaviationBarStyles()
setUpNavBarButtons()
navigationItem.title = "Kindle"
tableView.register(BookCell.self, forCellReuseIdentifier: "cellId")
tableView.backgroundColor = UIColor.lightGray
fetchBooks()
}
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = .red
return view
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 50
}
Run Code Online (Sandbox Code Playgroud)
这个问题似乎是针对iPhone x的?在iPhone 7模拟器中,上面的代码完美地运行:
我试图在viewDidLoad中创建一个自定义视图,就像很多其他线程一样,但还没有这样的运气:
let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width:
tableView.frame.size.width, height: 40))
view.backgroundColor = .red
self.tableView.tableFooterView = view
Run Code Online (Sandbox Code Playgroud)
我很欣赏这个问题的任何帮助,似乎解决方案可能很简单,但我已经研究了一段时间,并且在使用iPhone …
我知道有一些问题与这个问题类似,但是,其中很多都在 Objective C 中,我还没有找到一个真正适用的解决方案。
我遇到的主要问题是,当我注销应用程序中的一个帐户,然后登录另一个帐户时,选项卡栏不会重置,并且会显示之前登录的用户数据。换句话说,我需要一种方法将应用程序“重置”回任何用户登录之前的状态。
我尝试通过在 App Delegate (setupTabBarController) 中编写一个函数并在用户注销时调用它来实现此目的,但还没有这样的运气。
这是我到目前为止所拥有的:
注销代码:
@objc func handleSignOutButtonTapped() {
let signOutAction = UIAlertAction(title: "Sign Out", style: .destructive) { (action) in
do {
try Auth.auth().signOut()
let welcomeControl = WelcomeController()
let welcomeNavCon = UINavigationController(rootViewController: welcomeControl)
self.present(welcomeNavCon, animated: true, completion: nil)
} catch let err {
print("Failed to sign out with error", err)
Service.showAlert(on: self, style: .alert, title: "Sign Out Error", message: err.localizedDescription)
}
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
Service.showAlert(on: self, …Run Code Online (Sandbox Code Playgroud)