-1
我正在使用带有自定义XIB的Storyboard,在升级到swift 2和xcode 7之前,所有内容都会正常加载。升级完成后,可以将故事板转换为xcode 8.我的viewcontroller显示视图,但它缺少我的自定义XIB。看看故事板文件,它看起来像一个故事板与自定义XIB转换的错误。还有谁有相同的问题吗?用Swift 3加载时自定义XIB缺失3 Xcode 8
required public init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: self.dynamicTypeName, bundle: bundle)
let nibView = nib.instantiate(withOwner: self, options: nil).first as! UIView
self.mainView = nibView
self.mainView.frame = bounds
self.mainView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mainView.translatesAutoresizingMaskIntoConstraints = true
self.addSubview(mainView)
}
我也面临同样的问题,你有没有找到任何解决方案。 –
是的,尝试在layoutSubviews – RiceAndBytes
中设置您的自定义xib框架不知道为什么它不自动拍摄框架,尽管提供的房间仍然是全屏幕(比如mainscreen.rect) –