ios - Objective-C way or compiler directive to force a class file include a method without adding a protocol? -


I have a custom singleton mycolor class that can easily easily change the color of several buttons with many UIViewController s can change at the same time.

I put #import "MyColors.h" in every code I need to get the color of a button.

Everything works perfectly and setting the color value in MyColors , the color is applied correctly where I want to.

Now, I want to change the vibrant colors so I send NSNotification name "COLORS_CHANGED" .

So every class sees it and immediately applies color.

What do I have to do:

Force XCode to remind me that .m file containing MyColors H is included to see the colorsChanged method should also be included, therefore, it will stop the mistake of adding a supervisor to me

OR:

Add something like category or something like this MyColors.h to do this ...

What I do not want to do:

I do not want to make a protocol and it is not Yek is .m Add as representatives to the files of the file, including MyColors.h . Because I can forget it too .. If not, then it will be the perfect path ...

So, I am trying to find a way to do this, or a compiler Ways to do this work XCode

Thank you for sharing your thoughts.

Update : I use color values ​​for anything that just does not require the color of the buttons.

Apply this functionality to a base class and all your UIViewController - i.e. - the base for this notification Modify the colors of the normal objects in the class register and change their additional objects colors to say a virtual method for the inheriters.

Good luck,

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -