3

I have instances of a custom view class in a XIB that I need to initialize by calling a custom initializer that takes certain parameters. In order to configure these in interface builder I need to pass those parameters somehow to the initializer, i.e. initWithCoder so I can redirect that to the correct initializer.

So I'm thinking the user-defined runtime attributes would be perfect for this, but can't find any info on how to access these from the coder object passed to initWithCoder.

Does anyone know how to do this, or alternatively have another way that I can initialize a custom (third-party) view class that has its own custom initializer method from a XIB? I can tweak the class a bit but I don't want to rewrite it.

Update: I ended up just modifying the class to have a separate setup method instead of doing all the setup in the initializer, which makes things a lot easier. However I'm still curious if this is even possible the other way.

devios1
  • 36,899
  • 45
  • 162
  • 260

0 Answers0