Skip to content

Instantly share code, notes, and snippets.

@terrybu
Created November 13, 2015 22:38
Show Gist options
  • Save terrybu/a25801bf04325acec562 to your computer and use it in GitHub Desktop.
Save terrybu/a25801bf04325acec562 to your computer and use it in GitHub Desktop.
class TasteMatchesView: UIView {
var view: UIView!
override init(frame: CGRect) {
super.init(frame: frame)
setUp()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setUp()
}
func setUp() {
view = loadViewFromNib()
view.frame = bounds
view.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]
addSubview(view)
}
func loadViewFromNib() -> UIView {
let bundle = NSBundle(forClass: self.dynamicType)
let nib = UINib(nibName: "TasteMatchesView", bundle: bundle)
return nib.instantiateWithOwner(self, options: nil)[0] as! UIView
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment