我创建了一个自定义视图,但是当我将它添加到情节提要屏幕时,它不显示内容(当启动应用程序时,显示所有内容)。 看到lesson后,我意识到我需要添加" IBDesignable"在课堂前,但没有帮助,我没有在View中看到内容。此外,现在Xcode报告了渲染错误:
"IB Designables: Failed to render and update auto layout status for Test1ViewController (R7h-8I-M68): The agent threw an exception.".
我问你的建议
import UIKit
@IBDesignable class ww: UIView {
var view: UIView!
@IBOutlet weak var yellowLine: UIView!
override init(frame: CGRect) {
super.init(frame: frame)
self.commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.commonInit()
}
func commonInit()
{
let view = Bundle.main.loadNibNamed("ww", owner: self, options: nil)?.first as! UIView
view.frame = self.bounds
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.addSubview(view)
}
}
P.S。 - 我无法添加图片,因为我的声誉< 10
答案 0 :(得分:0)
<head>
<title>Pacific Trails Resort</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<link href="pacific.css" rel="stylesheet">
<link href="pacificprint.css" rel="stylesheet" media="print">
</head>
“refundViewController”是我的UIViewController类。