- Get link
- Other Apps
In custom UIView class class NearByOffer: UIView, override the init method as follows override init (frame: CGRect ) { super . init (frame: frame) xibSetup () } required init ?(coder aDecoder: NSCoder ) { super . init (coder: aDecoder) } Set up the xib as follows:- func xibSetup() { view = loadViewFromNib () view . frame = bounds view . autoresizingMask = [ UIViewAutoresizing .FlexibleWidth, UIViewAutoresizing .FlexibleHeight] // Adding custom subview on top of our view (over any custom drawing > see note below) view . backgroundColor = UIColor (white: 1.0 , alpha: 0.5 ) addSubview ( view ) } Load view from custom nib/xib as follows:- func loadViewFromNib() -> UIView { let bundle = NSBundle (forClass: self . dynamicType ) let nib = UINib