Pergunta

I need a way to conditionally define the superclass of a class based on a value in NSUserDefaults.

I know one can define different interfaces based on #ifdef directive. I wonder if the same can be achieved with #if directive? If not, is there some other way to achieve my goal?

Thank you!

Foi útil?

Solução

You cannot do that with a preprocessor directive, since it would be determined at compile time while NSUserDefaults is something you want to check at runtime.

I think this thread could help you Dynamically change an object's superclass Anyway, are you sure this is the best you can do by design? Why would you change the superclass at runtime based on something in NSUserDefaults?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top