0

I have a Custom UIView that I want to initialize from a nib. I don't have access to the name of the nib, all I have is an instance of UINib.

How can I initialize my UIView using this UINib object?

I don't want to use loadNibNamed method in NSBundle

aryaxt
  • 76,198
  • 92
  • 293
  • 442

1 Answers1

2

If the UINib object already exists, send it an -instantiateWithOwner:options: message.

NSResponder
  • 16,861
  • 7
  • 32
  • 46
  • That didn't work, I tried to call methods on my custom UIView and it crashes because the final object is type of UINib instead of my subclass of UIView – aryaxt Nov 06 '11 at 17:34
  • This should work, if you have the UINib already -instantiateWithOwner:options: returns an array of top-level objects in the nib it's associated with. – Perishable Dave Feb 09 '12 at 19:26