ios - Swift/如何修复 : TableView bottom cells missing in size of the UINavigationBar

标签 ios swift

我正在使用 this Framework有一个移动的 UINavigationBar。我对每个 View 都有以下问题(因为每个 View 都有一个 UITableViewUICollectionView - 是的,这个错误也出现在 UICollectionView 中)

enter image description here

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。同样的错误出现在所有其他带有 UITableViewUIViewController 以及带有 UICollectionViewUITableViewController 中。

我错过了什么?非常感谢您的帮助。

最佳答案

您需要做的是创建一个全局常量并设置 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/

相关文章:

IOS:在应用程序可见之前强制更新

swift - 使用参数在其他 View Controller 上设置闭包

ios - 如何知道使用 MapKit 的异步搜索何时完成

使用 Crypto Swift 的 iOS 13 AES 解密不起作用

json - 如何使用 "username"更改导航项标题?

ios - 如何使用另一个 View Controller 类的数组?

iphone - 简单表格导航帮助

ios - MBProgressHUD 与 Swift、Fabric 和 TwitterKit

ios - MR_saveToPersistentStoreAndWait 不保存数组中的数据

ios - 我的应用程序在设备上崩溃 XCode,在模拟器上没有崩溃