我的课程BottomTabView
上发生了奇怪的内存泄漏。
我有class func
通过xib
Bundle.main.loadNibNamed
加载它的类实例
@objc class func loadFromNib() -> BottomTabView? {
if let topLevelObjects = Bundle.main.loadNibNamed("BottomTabView", owner: nil, options: nil) { // <<< this is a memory leak
if topLevelObjects.count > 0 {
let view = topLevelObjects[0] as? BottomTabView
if let view = view {
var rect = view.frame
rect.size.height = BottomTabView.Height
view.frame = rect
view.shiftConstraint?.constant = BottomTabView.Shift
}
return view
}
}
return nil
}
我该如何解决?我不明白是什么原因。