Yol*_*dan 6 nib iboutlet ios swift swift3
真的需要你的帮助!我已经完成了解决这个问题的所有可能的帖子,但似乎没有任何效果.
所以我使用.xib文件在ProfileFoldingCellView.swift中创建一个子视图,它完全有效,直到我尝试在同一个类中添加一个IBOutlet.这是代码:
import Foundation
import UIKit
class ProfileFoldingCellView: UIView {
@IBOutlet var mainLabel: UILabel!
public var cellIndex: Int = 0
init(index: Int) {
super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
cellIndex = index
print("Index: \(cellIndex)")
setupContentView()
}
func setupContentView() {
let contentView = UINib(nibName: "ProfileFoldingCellView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! UIView
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(contentView)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupContentView()
}
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,标签IBOutlet的创建没有任何问题,并且没有其他过时或未使用的插件漫游.
我还确保将ProfileFoldingCellView.swift设置为文件所有者的类.
一切都运行良好,直到我连接插座!然后我收到这个错误:
相信我,我已经尝试了一切.我可能已经重新创建了一百万次,没有任何工作.任何帮助将不胜感激!
| 归档时间: |
|
| 查看次数: |
2252 次 |
| 最近记录: |