Skip to content

Instantly share code, notes, and snippets.

@Jxrgxn
Created April 3, 2018 16:08
Show Gist options
  • Save Jxrgxn/0f4649bf2122d84216ebdafc74d115b8 to your computer and use it in GitHub Desktop.
Save Jxrgxn/0f4649bf2122d84216ebdafc74d115b8 to your computer and use it in GitHub Desktop.
import UIKit
class TestView: UIView {
@IBOutlet var contentView: UIView!
@IBOutlet weak var mainLabel: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
private func commonInit() {
Bundle(for: TestView.self).loadNibNamed("TestView", owner: self, options: nil)
contentView.frame = self.bounds
contentView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
addSubview(contentView)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment