Domanda

I have created a UIImageView subclass. I have both the .h and .m files. I have a property in my UIImageView subclass. I dragged a UIImageView in a UIViewController. Now, I want to give a default value to the property. For example, i have an enum, and according to that enum value, i want to set the image of my imageView. How to give this value, when i am not calling the init method, i am loading it directly from the xib. I am stuck on this. Spent a lot of time, but not able to work it out.

È stato utile?

Soluzione

Ok i worked it out. I overrided the method:

initWithCoder:

and instantiated the values in that method!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top