我正在使用 this Framework有一个移动的 UINavigationBar
。我对每个 View 都有以下问题(因为每个 View 都有一个 UITableView
或 UICollectionView
- 是的,这个错误也出现在 UICollectionView
中)
UINavigationBar
的大小缺少每个屏幕的底部。
Controller 是 UIViewController
的子类。
open class SLPagingViewSwift: UIViewController, UIScrollViewDelegate
UIViewControllers
是全局创建的:
var settingsVC: UserSettingsVC?
在创建 Controller 的类中实例化:
appDelegate.window = UIWindow(frame: UIScreen.main.bounds)
settings = settingsStb.instantiateViewController(withIdentifier: "UserSettingsVC") as? UserSettingsV
// among other VCs
self.setItems() //sets the images at the navigationbar
let items = [itemsArray]
let controllers = [arrayOfVCs] as [UIViewController]
controller = SLPagingViewSwift(items: items, controllers: controllers, showPageControl: false)
controller.indexSelected = 1
nav = UINavigationController(rootViewController: controller)
appDelegate.window?.rootViewController = nav
appDelegate.window?.backgroundColor = cachedBlack
appDelegate.window?.makeKeyAndVisible()
示例 Controller 是一个 UITableViewController
。同样的错误出现在所有其他带有 UITableView
的 UIViewController
以及带有 UICollectionView
的 UITableViewController
中。
我错过了什么?非常感谢您的帮助。
最佳答案
您需要做的是创建一个全局常量并设置 UIEdgeInsetsMake(),例如:
let collectionViewInset = UIEdgeInsetsMake(0, 0, 44, 0)
44是导航栏的高度,需要在navigationBar之后开始,所以y = 44.0。
完成之后你需要设置:
collectionView.contentInset = collectionViewInset
就是这样,排序!
关于ios - Swift/如何修复 : TableView bottom cells missing in size of the UINavigationBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40230205/