I tried to make @IBDesignable UIView subclass following this (link) tutorial. First custom view goes fine. But when I try to make another one, I have errors. First I got failed to update auto layout status: the agent crashed
and Failed to render instance of ...
. Somehow I started to be able to biuld and run project with these errors, but then I get new error - EXC_BAD_ACCESS ...
on line let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
. Here is whole method:
func loadViewFromNib() -> UIView {
let bundle = NSBundle(forClass: self.dynamicType)
let nib = UINib(nibName: "advancedCellView", bundle: bundle)
let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
return view
}
With first custom UIView is no problem. I use same code..
Any ideas? Thank you
NSBundle:forClass:
instead of just accessingNSBundle.mainBundle()
? Is thisnib
stored in a different bundle? – Dumanib
, but with something in thexib
file itself. Did you change theclass
for your view subclass in interface builder for thexib
? – Duma